[BUG] tolist() broken in 8.0.5

#1

Updated an existing project from 8.0.4 to 8.0.5. All my scripts that used .tolist() broke and gave error “object has no type .tolist()”. For example, grabbing the data from a table and using .tolist() on it. Reverted back to 8.0.4 and everything worked again.

0 Likes

[BUG-15347] ObjectWrapper modification
#2

Can you give us an example of code that broke? What were you calling tolist() on?

0 Likes

#3

list = self.parent.parent.getChild(“Table”).props.data.tolist()

0 Likes

#4

The document ‘wrapper’ objects got updated - this is unintentional fallout from that change. Rather than calling tolist(), you can just use the builtin list() function: list = list(self.parent.parent.getChild(“Table”).props.data) - but, with the improved wrappers in 8.0.5, you hopefully shouldn’t actually need to do that - most features of the list class should be implemented by the wrapper objects already.

1 Like

#5

On 8.0.6, I’m having issues using list() to get the Widgets list converted to a json string for the DB.

If I grab the item directly I get all the ArrayWrappers and ObjectWrappers. Doing a list() only seems to remove the ArrayWrapper but leaves the ObjectWrapper internally

Any ideas?

0 Likes

#6

Try this, in the meantime - I need to come up with a better way to handle conversion to json (or, our jsonEncode function needs to get better at encoding objects)

from com.inductiveautomation.ignition.common import TypeUtilities
jsonObject = TypeUtilities.pyToGson(<yourobject>)
print jsonObject
1 Like