Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Python 2.7 compatibility #10

Open
stuartmac opened this issue Sep 6, 2017 · 3 comments
Open

Python 2.7 compatibility #10

stuartmac opened this issue Sep 6, 2017 · 3 comments
Assignees

Comments

@stuartmac
Copy link
Member

stuartmac commented Sep 6, 2017

CLI gives an error due to suppress in Python 2.7:

$ ProIntVar download --mmcif 2pah
Traceback (most recent call last):
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/bin/ProIntVar", line 11, in <module>
    load_entry_point('ProIntVar-Core==0.1', 'console_scripts', 'ProIntVar')()
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 565, in load_entry_point
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 2598, in load_entry_point
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 2258, in load
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/lib/python2.7/site-packages/setuptools-27.2.0-py2.7.egg/pkg_resources/__init__.py", line 2264, in resolve
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/lib/python2.7/site-packages/ProIntVar_Core-0.1-py2.7.egg/cli/main.py", line 8, in <module>
    from prointvar.fetchers import fetch_best_structures_pdbe
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/lib/python2.7/site-packages/ProIntVar_Core-0.1-py2.7.egg/prointvar/fetchers.py", line 20, in <module>
    from prointvar.utils import fetch_from_url_or_retry
  File "/homes/smacgowan/anaconda2/envs/varalign_dev/lib/python2.7/site-packages/ProIntVar_Core-0.1-py2.7.egg/prointvar/utils.py", line 28, in <module>
    from contextlib import suppress
ImportError: cannot import name suppress
@biomadeira
Copy link
Collaborator

biomadeira commented Sep 6, 2017

Simple fix da94f07 + f754aa2 that avoids using the suppress function.

@biomadeira
Copy link
Collaborator

@stuartmac Just tried to run the tests with Python 2.7 and many failed. I guess there are other incompatibilities. By the looks of it, I think mostly related to string/bytes and unicode differences...

Things that I could see don't work/exist in Python 2.7 are for example os.makedirs(db_dir, exist_ok=True) and identifier = str(r.content, encoding='utf-8')...

@biomadeira biomadeira self-assigned this Sep 6, 2017
@stuartmac
Copy link
Member Author

@biomadeira It would be reasonable to make Python 3.x+ a requirement if it turned out to be too much effort to incorporate Python 2 compatibility. Sooner or later the world will probably move on to it... Faster when fewer packages support Python 2!

Although, it would probably simplify using Arpeggio and OpenBabel if you could use Python 2...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants