homepage

This issue tracker has been migrated to GitHub , and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: html.entities ImportError in distutils2/pypi/simple.py on Python2.7
Type: behavior Stage: resolved
Components: Distutils2 Versions: 3rd party
process
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: eric.araujo Nosy List: alexis, eric.araujo, ezio.melotti, goibhniu, tarek
Priority: normal Keywords:

Created on 2013年01月20日 10:54 by goibhniu, last changed 2022年04月11日 14:57 by admin. This issue is now closed.

Messages (3)
msg180285 - (view) Author: Cillian de Róiste (goibhniu) Date: 2013年01月20日 10:53
I guess it should be wrapped in a try, except:
try:
 from html.entities import name2codepoint
except ImportError:
 from htmlentitydefs import name2codepoint
This works locally
Here's a sample traceback:
Traceback (most recent call last):
 File "python2nix.py", line 119, in <module>
 egg_release = pypi.get_release(egg['name'] + '==' + version)
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 201, in get_release
 releases = self.get_releases(predicate, prefer_final)
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 189, in get_releases
 self._process_index_page(predicate.name)
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 75, in wrapped
 return func(self, *args, **kwargs)
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 397, in _process_index_page
 self._process_url(url, name)
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 320, in _process_url
 for link, is_download in link_matcher(f.read().decode(), base_url):
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 362, in _simple_link_matcher
 url = self._get_full_url(match.group(1), base_url)
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 349, in _get_full_url
 return urlparse.urljoin(base_url, self._htmldecode(url))
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 469, in _htmldecode
 return ENTITY_SUB(self._decode_entity, text)
 File "/nix/var/nix/profiles/plone/lib/python2.7/site-packages/Distutils2-1.0a4-py2.7.egg/distutils2/pypi/simple.py", line 463, in _decode_entity
 from html.entities import name2codepoint
ImportError: No module named html.entities
msg180287 - (view) Author: Ezio Melotti (ezio.melotti) * (Python committer) Date: 2013年01月20日 11:12
htmlentitydefs was renamed to html.entities in Python 3.
If this is supposed to run with Python 2 it should use the former, otherwise the latter (unless it has the same codebase on both).
msg180308 - (view) Author: Éric Araujo (eric.araujo) * (Python committer) Date: 2013年01月20日 19:20
Good call. All function-level imports are avoided in d2 unless absolutely necessary, and this one slipped through the cracks. distutils2 went from Python 2 to 3 to 2 and 3 again, so these things happen (and it’s one of the reasons why I’ve always insisted on trying to keep as much history as possible in one repo).
Will fix, as even though d2 will not continue to live as one monolithic project, the pypi submodule will certainly be extracted in a smaller lib reusable by other tools.
History
Date User Action Args
2022年04月11日 14:57:40adminsetgithub: 61204
2014年03月13日 03:48:53eric.araujosetstatus: open -> closed
resolution: out of date
stage: test needed -> resolved
2013年01月20日 19:20:50eric.araujosetstage: test needed
messages: + msg180308
versions: + 3rd party, - Python 2.7
2013年01月20日 11:12:09ezio.melottisettype: crash -> behavior

messages: + msg180287
nosy: + ezio.melotti
2013年01月20日 10:54:01goibhniucreate

AltStyle によって変換されたページ (->オリジナル) /