pkg_resources.require() in Python 3 raises TypeError instead of pkg_resources.DistributionNotFound
Open
Nobody has claimed this yet.
bug
minor
- Dominant language
- Python
- Stars
- 2.9k
- Forks
- 1.4k
- Avg merge
- 1d 1h
- Merged PRs (30d)
- 1
Description
Originally reported by: arfrever (Bitbucket: arfrever, GitHub: arfrever)
$ python2.7 -c 'import pkg_resources; pkg_resources.require("aaa")'
-c:1: UserWarning: Unbuilt egg for setuptools [unknown version] (/tmp/setuptools)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "pkg_resources.py", line 728, in require
needed = self.resolve(parse_requirements(requirements))
File "pkg_resources.py", line 622, in resolve
raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: aaa
$ python3.4 -c 'import pkg_resources; pkg_resources.require("aaa")'
-c:1: UserWarning: Unbuilt egg for setuptools [unknown version] (/tmp/setuptools)
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "/tmp/setuptools/pkg_resources.py", line 728, in require
needed = self.resolve(parse_requirements(requirements))
File "/tmp/setuptools/pkg_resources.py", line 607, in resolve
env = Environment(self.entries)
File "/tmp/setuptools/pkg_resources.py", line 785, in __init__
self.scan(search_path)
File "/tmp/setuptools/pkg_resources.py", line 815, in scan
self.add(dist)
File "/tmp/setuptools/pkg_resources.py", line 835, in add
dists.sort(key=operator.attrgetter('hashcmp'), reverse=True)
TypeError: unorderable types: NoneType() < str()
Contributor guide
No contributing guide indexed for this repository
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Reproduce the Python 2.7 and 3.4 commands from the issue, then inspect pkg_resources.py at require(), resolve(), Environment.scan(), and add(), where the Python 3 traceback reaches sorting. Done means requesting the missing aaa package on Python 3 raises pkg_resources.DistributionNotFound instead of TypeError.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- python
- Domain
- build-system
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 35/100