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

Filter out None results before sorting python version list #90

Closed

Conversation

Systemcluster
Copy link

This solves the issue of trying to sort non-python results in the find_all_python_versions function.

This was attempted in #87, but this is still an issue for me and a lot of other users.

For some reason, the versions list can contain non-existing entries. For instance on my machine it contains among others an entry of a version I uninstalled a long time ago:

PathEntry(path=WindowsPath('C:/Users/Chris/AppData/Local/Programs/Python/Python37/python.exe'), _children={}, only_python=True, name='3.7', _py_version=None, _pythons=defaultdict(None, {}), _is_dir=False, _is_executable=False, _is_python=False, is_root=False), 

When as_python.version_sort of such an entry is accessed in order to sort the list, it panics because as_python returns None.

It would probably be best to attack this issue at the source as well, but filtering out these kind of results at the location where they're accessed is a start.

@Systemcluster
Copy link
Author

Systemcluster commented Sep 11, 2020

I just noticed that 795fe9a tackled this issue as well (I think?), so this might not be needed anymore. Should this still be checked at this location to guard against regressions or other sources of invalid entries?

@Systemcluster
Copy link
Author

Any interest in merging this @frostming?

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

Successfully merging this pull request may close these issues.

None yet

2 participants