Nuke 13 beta is out and with that comes the final piece of our pipeline to move over to Python 3.
It's a lot of work to transform all our Nuke pipeline to Python 3 so I figured I get started right away.
The Nuke submitter is failing on some str / unicode things in regards to XML.
Looking at the code, a lot of it doesn't even makes sense... like this part in py2, which errors out in py3 because unicode doesn't exist in py3:
if (type(text) == unicode ):
sub.text = text.encode('utf8')
else:
sub.text = str(text).decode("utf8")
That basically translates to:
If text is unicode, convert to str
else, convert to str and then convert to unicode.
That doesn't makes sense at all. Since ElementTree want to work with unicode, it should be like this instead, right??
if type(text) is unicode:
sub.text = text
else:
sub.text = str(text).decode("utf8")
So what do you think is the right thing to do here. As I see it there are two options...
1. Change the Nuke submitter to work in both python2 and python3? Would require several if sys.version_info.major == 2: statements to get around the unicode dilemma.
2. Create a new modern and pure py3 rrSubmit_Nuke_13.py and use that going forward?
Personally I would opt for no 2. and start with a clean slate, but that is only if you guys have time to rewrite it.
In the meantime I will probably hack together a py3 submitter so we can get to testing asap, but it would be great if this was solved by you guys soon as well.
Or if you would like me to submit a PR on github, with either option 1 or 2 above, just let me know.
Cheers,
//Jens Lindgren