srsudar / eg

Useful examples at the command line.
MIT License
1.82k stars 99 forks source link

compatibility with Python3 #7

Closed StatelessCat closed 9 years ago

StatelessCat commented 9 years ago

In python 3.4 (or any Python3 envs) we got:

Traceback (most recent call last):
  File "/usr/bin/eg", line 3, in <module>
    from eg import eg_exec
  File "/usr/lib/python3.4/site-packages/eg/eg_exec.py", line 74
    print 'you must specify a program or pass the --list or --version flags'
                                                                           ^
SyntaxError: Missing parentheses in call to 'print'
srsudar commented 9 years ago

Can one of you try the current tip and see if it works? Note that you'll have to invoke eg using the eg_exec.py script, which USED to be located at eg/eg_exec.py, but is now at the top level. This had to happen for the way python 2 vs 3 resolves imports.

You can either clone and run (from the root of the repo): python eg_exec.py find, or you can try installing it via pip: pip install -i https://testpypi.python.org/pypi eg.

Both work for me with python 2.7 and python 3.4, but if you guys can confirm that would be great.

StatelessCat commented 9 years ago

I just tried after cloning your repo, both python2.7 eg_exec.py and python3.4 eg_exec.py works. Nice work

srsudar commented 9 years ago

Great, thanks for checking.

Thanks also go to @Brobin for doing the bulk of the 3.x compatibility changes.

srsudar commented 9 years ago

Python3 is now supported in 0.1.0+.

Thanks again to @Brobin .

StatelessCat commented 9 years ago

Cool work, thanks :)