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

find_python_version raises TypeError if PYENV_ROOT is set #48

Closed
mndavidoff opened this issue Nov 21, 2018 · 3 comments
Closed

find_python_version raises TypeError if PYENV_ROOT is set #48

mndavidoff opened this issue Nov 21, 2018 · 3 comments

Comments

@mndavidoff
Copy link

find_python_version raises TypeError if the PYENV_ROOT environment variable is set.

$ export PYENV_ROOT=~/.pyenv
$ python3
>>> from pythonfinder import Finder
>>> Finder().find_python_version(3)
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/pythonfinder.py", line 113, in find_python_version
    return self.system_path.find_python_version(
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/pythonfinder.py", line 54, in system_path
    ignore_unsupported=self.ignore_unsupported,
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/models/path.py", line 451, in create
    ignore_unsupported=ignore_unsupported,
  File "<attrs generated init 75e45f144e3d5510d54dd5fca6730b98fa0220a9>", line 38, in __init__
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/models/path.py", line 116, in __attrs_post_init__
    self._setup_pyenv()
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/models/path.py", line 196, in _setup_pyenv
    version_glob_path="versions/*", ignore_unsupported=self.ignore_unsupported
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/models/python.py", line 154, in create
    sort_function=sort_function, version_glob_path=version_glob_path)
  File "<attrs generated init 031499b6371f4a9df9919a42577a7ef217b32ad9>", line 17, in __init__
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/models/python.py", line 98, in get_versions
    for p in self.get_version_order():
  File "/home/mdavidoff/.pyenv/versions/3.7.1/lib/python3.7/site-packages/pythonfinder/models/python.py", line 70, in get_version_order
    version_order = [versions[v] for v in parse_pyenv_version_order()]
TypeError: 'NoneType' object is not iterable
>>> import pythonfinder
>>> pythonfinder.__version__
'1.1.9.post1'

It works if PYENV_ROOT is not set:

$ unset PYENV_ROOT
$ python3
>>> from pythonfinder import Finder
>>> Finder().find_python_version(3)
PathEntry(path=PosixPath('/home/mdavidoff/.pyenv/versions/3.7.1/bin/python3.7m'), _children={}, is_root=False, only_python=False, name='python3.7m', py_version=PythonVersion(major=3, minor=7, patch=1, is_prerelease=False, is_postrelease=False, is_devrelease=False, is_debug=False, version=<Version('3.7.1')>, architecture=None, comes_from=..., executable=None, name='python3.7m'), _pythons=defaultdict(None, {}))
@jxltom
Copy link
Collaborator

jxltom commented Nov 21, 2018

It should already be fixed in master branch by #43 and #38

@mndavidoff
Copy link
Author

I tried the current version on the master branch. It looks like the problem is indeed fixed. Thanks!

@thedrow
Copy link

thedrow commented Nov 21, 2018

@mndavidoff Mind closing the issue then?

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

No branches or pull requests

3 participants