I recently upgraded to python 3.4 to use continuum tools but many of my scripts are written for 2.7. This can causes some errors; some are simple (like "print" now requires parentheses), but others are more complicated:
if struct.unpack("h", "\0\1")[0] == 1:
defs.append(("WORDS_BIGENDIAN", None))
Yields the error:
File "setup.py", line 302, in build_extensions
if struct.unpack("h", "\0\1")[0] == 1:
TypeError: 'str' does not support the buffer interface
Is there a way to run my python code as 2.x like you can with C++ (-std=c++11 etc) ? It's possible that many more errors will surface if I just solve this one. Thanks!
2to3.py
converter that comes with python 3 that will attempt to update your code for you, for one. But there's probably work you'll have to do yourself as well.