Some Extra Considerations: Python 2-3

You can use the handy 2to3 script included with a Python 3 install, and I sincerely hope that solves all of your problems. If it doesn’t, here are some things to think about…

The default open() behavior changes between versions, namely in what it considers a newline. I had something strange happen: the same things that Windows wouldn’t consider a newline (\n) for some reason Python 2 open() didn’t seem to consider a newline either. Python 3 open() default does consider \n to be a newline.

Oddly, it caught another error that my previous version of the script didn’t catch…but I still can’t figure out why that one wasn’t caught before. While I still don’t understand fully all the inner workings of Stella and thus rely on some of this program structure for now, I came across a part that was trying to write out a convertor for a variable name that was part of a GRAPH function. The thing it was trying to write, though, was also a GRAPH function, which was throwing an error (and it should have in the prior script, too). So I had to add the condition to check if the thing it was trying to write wasn’t itself data…

if (convertors[conv].Data.xname not in convT2 and convertors[conv].Data.xname in convlist and not convertors[(convertors[conv].Data.xname)].isData):

Leave a Reply

Your email address will not be published. Required fields are marked *