skyfielders / python-skyfield

Elegant astronomy for Python
MIT License
1.41k stars 211 forks source link

python2.7 doesn't support 'nonlocal' #289

Closed ckuethe closed 4 years ago

ckuethe commented 4 years ago
macbook:python-skyfield ckuethe$ sudo python2.7 setup.py install
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'extras_require'
  warnings.warn(msg)
/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/distutils/dist.py:267: UserWarning: Unknown distribution option: 'install_requires'
  warnings.warn(msg)
running install
running build
running build_py
copying skyfield/charting.py -> build/lib/skyfield
running install_lib
copying build/lib/skyfield/charting.py -> /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skyfield
byte-compiling /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skyfield/charting.py to charting.pyc
  File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skyfield/charting.py", line 176
    nonlocal planet_art
                      ^
SyntaxError: invalid syntax

running install_egg_info
Removing /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skyfield-1.12-py2.7.egg-info
Writing /opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/skyfield-1.12-py2.7.egg-info
macbook:python-skyfield ckuethe$ python2.7
Python 2.7.16 (default, Sep  7 2019, 20:10:32) 
[GCC 4.2.1 Compatible Apple LLVM 10.0.1 (clang-1001.0.46.4)] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> nonlocal x
  File "<stdin>", line 1
    nonlocal x
             ^
SyntaxError: invalid syntax
>>> 
ckuethe commented 4 years ago

I know about python2 deprecation, that's not important. From the user perspective I just expect to be able to run sudo python setup.py install and have it just work given that README says:

Skyfield is a pure-Python astronomy package that is compatible with both Python 2 and 3 ...

brandon-rhodes commented 4 years ago

I just expect to be able to run sudo python setup.py install and have it just work…

If I'm reading your output correctly, it did work, I think? Skyfield wound up correctly and successfully installed and you could use it under Python 2? I think the error is from an optional step where it tries to byte-compile modules ahead of time as part of installation, in case users can't write to the directories later.

But the noisy message is indeed unfortunate. I'll see what I can do to get it to go away!