Python Bridge - 2D Lists from Python cannot be read back into OML
In the attached script, one can see that 1D lists such as list1=[1,2,3] can be imported in OML without a hassle.
Whereas when I try to import a list2=[(1,1),(2,2),(3,3)], I receive an error message in OML saying that list2 does not exist.
I use the command getpythonvar().
Am I missing something?
I have attached a file that can be used to reproduce my error message.
I am using Compose 2019.3
Thanks a bunch,
Deb
Find more posts tagged with
What you can do is to convert your tuple into list. An example:
t = ('my', 'name', 'is', 'mr', 'tuple')
l = list(t)
And then use getpythonvar to retrieve the variable.
Regards,
Roberta
Thanks, for the tip!
But I think it works for 1D lists again isn't it?
I have a tuple again as soon as I have a single 2D element as in t = [('my', 'name'), 'is', 'mr', 'tuple']
Hello Debdatta Sen,
I think the issue is in what is contained in the list: tuples.
Tuples are not supported. You can look at the supported Python DataTypes in the help page.
Here a screenshot:
<?xml version="1.0" encoding="UTF-8"?>
Regards,
Lorenzo