Open
Description
When trying to monkeypatch a copy of html.parser
, markdown fails when html.parser
comes from a zip file and an instance of zipimporter
is used as the loader.
To reproduce
- Download an embeddable package version of Python like the latest Windows embeddable package (64-bit) (Python 3.9.5)
- Unzip it
- Copy the markdown package into the python folder
- Run python
- Import markdown
- Notice the following traceback:
$ python
Python 3.9.5 (tags/v3.9.5:0a7dcbd, May 3 2021, 17:27:52) [MSC v.1928 64 bit (AMD64)] on win32
>>> import markdown
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "C:\Users\Rémy Roy\Projects\CDDA-Game-Launcher\build\test\markdown\__init__.py", line 29, in <module>
from .core import Markdown, markdown, markdownFromFile # noqa: E402
File "C:\Users\Rémy Roy\Projects\CDDA-Game-Launcher\build\test\markdown\core.py", line 27, in <module>
from .preprocessors import build_preprocessors
File "C:\Users\Rémy Roy\Projects\CDDA-Game-Launcher\build\test\markdown\preprocessors.py", line 29, in <module>
from .htmlparser import HTMLExtractor
File "C:\Users\Rémy Roy\Projects\CDDA-Game-Launcher\build\test\markdown\htmlparser.py", line 31, in <module>
spec.loader.exec_module(htmlparser)
AttributeError: 'zipimporter' object has no attribute 'exec_module'
The main issue is that the zipimporter
loader does not have an exec_module
method.