ModuleNotFoundError: No module named 'html.entities'; 'html' is not a package (python3 error)
Hya,
Situation While converting python2 script to python3, I ran into this error. Code:
ModuleNotFoundError: No module named 'html.entities'; 'html' is not a package System: Debian amd64, python 3.9.1 Troubleshooting Related 2to3 log follows: Code:
-import htmlentitydefs 1.1 Several html.py files exist under /usr/lib/python3 ( /usr/lib/python3/dist-packages/IPython/html.py, /usr/lib/python3/dist-packages/humanfriendly/terminal/html.py, /usr/lib/python3/dist-packages/wx/html.py, /usr/lib/python3/dist-packages/pygments/formatters/html.py /usr/lib/python3/dist-packages/pygments/lexers/html.py, /usr/lib/python3/dist-packages/prompt_toolkit/formatted_text/html.py) 1.2 It does not look like there is class/function/variable named entities. (I am not familiar with modulename.itemname. Tutorial section 6.1 says it is ok.) 2. This site mentions about this error. I am a kind of lost at this moment. If the former scenario, the error message is not quite correct. If the latter, it is 5 years old bug/issue. I need to figure out what I am missing. Question Does anybody know how to solve this? Closing remark Have a happy penguin! Any clue will be appreciated. |
Hya,
self reply, not solved yet. Under interactive mode Code:
>>> import html.entities cheers |
|
different python versions may (and should) have different PYTHONPATH settings and you need to install your modules using the appropriate one (including python2.X.Y and any python3.X.Y)
I guess mixing it is not a good idea (=using packages from another python version) also python2to3 will not install modules for you (but modules installed for python2 will not be available any more). |
All times are GMT -5. The time now is 04:50 PM. |