Search code examples
pythonpycharmpython-3.9

Python 3.9 and Pycharm, HTMLParser AttributeError


When trying to create new python 3.9 Virtualenv Environment in Pycharm I got such error

AttributeError: 'HTMLParser' object has no attribute 'unescape'


Traceback (most recent call last):
  File "/var/folders/6g/vnvmvlf51gv49m22rzj9zdtw0000gn/T/tmpifdsjw6lpycharm-management/setuptools-40.8.0/setup.py", line 11, in <module>
    import setuptools
  File "/private/var/folders/6g/vnvmvlf51gv49m22rzj9zdtw0000gn/T/tmpifdsjw6lpycharm-management/setuptools-40.8.0/setuptools/__init__.py", line 20, in <module>
    from setuptools.dist import Distribution, Feature
  File "/private/var/folders/6g/vnvmvlf51gv49m22rzj9zdtw0000gn/T/tmpifdsjw6lpycharm-management/setuptools-40.8.0/setuptools/dist.py", line 35, in <module>
    from setuptools.depends import Require
  File "/private/var/folders/6g/vnvmvlf51gv49m22rzj9zdtw0000gn/T/tmpifdsjw6lpycharm-management/setuptools-40.8.0/setuptools/depends.py", line 7, in <module>
    from .py33compat import Bytecode
  File "/private/var/folders/6g/vnvmvlf51gv49m22rzj9zdtw0000gn/T/tmpifdsjw6lpycharm-management/setuptools-40.8.0/setuptools/py33compat.py", line 55, in <module>
    unescape = getattr(html, 'unescape', html_parser.HTMLParser().unescape)
AttributeError: 'HTMLParser' object has no attribute 'unescape'

What can be done with it?


Solution

  • Based on Matthias comment

    To fix this error I have to update both pycharm (>=2020) and setuptools (>=41).

    Hope this will help somebody