Closed akerl closed 2 years ago
There are some code lines need to be fixed, like the print statement. If you just use print
as a function, then the code does not support python2.
One solution is put from __future__ import print_function
at the beginning of the file where we use print
as a function.
the other changed parts also must consider the compatibility of python 2 and 3.
@xiaopeng163 it's not true. Both python 2.7.15 and sytem python 2.7.10 will print a line with letters Hello world
for an one-line program below
print("Hello world")
@eirnym yes, but if we want to say python 2 support, we may not only support python 2,7 +
(you have no lines with syntax should be changed, so 2.6 could be used as a minimum requirement)
There's a few points to notice:
print
usages are print()
already, except of 6 which easy to convert. Future print_function
support is starting with Python 2.6
raw_input
and check if object is a unicode
on the second (this easily covered by six
or manually)BTW, I don't know which python less than 2.6 you really want to support in 2018 as I don't know a system where you are not able to run at least Python 2.6.
With print()
in worst case will end up with messages in brackets, like (printed message)
, with upgrading this line with deprecated syntax will break compatibility with python 2.3 or even less. Finally, patching will not break anything. I don't believe that this script would run on Python 2.2 or less due to dependencies you use.
This is based on #90 but accounts for more recent changes