zopieux / py-gfm

Github-Flavored Markdown for Python-Markdown.
https://pypi.org/project/py-gfm/
BSD 3-Clause "New" or "Revised" License
71 stars 14 forks source link

AttributeError: Failed to initiate extension 'gfm': module 'gfm' has no attribute 'makeExtension' #21

Closed rjollos closed 4 years ago

rjollos commented 4 years ago

I have a script that executes python -m markdown -x gfm README.md > README.html. This stopped working, I suppose due to a recent update in either Markdown or py-gfm? Python version 3.8.4.

Markdown 3.2.2 py-gfm 1.0.0

Traceback (most recent call last):
  File "/Users/rjollos/.pyenv/versions/3.8.4/lib/python3.8/runpy.py", line 194, in _run_module_as_main
    return _run_code(code, main_globals, None,
  File "/Users/rjollos/.pyenv/versions/3.8.4/lib/python3.8/runpy.py", line 87, in _run_code
    exec(code, run_globals)
  File "/Users/rjollos/.pyenv/versions/e4990a/lib/python3.8/site-packages/markdown/__main__.py", line 151, in <module>
    run()
  File "/Users/rjollos/.pyenv/versions/e4990a/lib/python3.8/site-packages/markdown/__main__.py", line 145, in run
    markdown.markdownFromFile(**options)
  File "/Users/rjollos/.pyenv/versions/e4990a/lib/python3.8/site-packages/markdown/core.py", line 403, in markdownFromFile
    md = Markdown(**kwargs)
  File "/Users/rjollos/.pyenv/versions/e4990a/lib/python3.8/site-packages/markdown/core.py", line 95, in __init__
    self.registerExtensions(extensions=kwargs.get('extensions', []),
  File "/Users/rjollos/.pyenv/versions/e4990a/lib/python3.8/site-packages/markdown/core.py", line 122, in registerExtensions
    ext = self.build_extension(ext, configs.get(ext, {}))
  File "/Users/rjollos/.pyenv/versions/e4990a/lib/python3.8/site-packages/markdown/core.py", line 176, in build_extension
    return module.makeExtension(**configs)
AttributeError: Failed to initiate extension 'gfm': module 'gfm' has no attribute 'makeExtension'
rjollos commented 4 years ago

The command succeeds when 0.1.4 is installed.

$ pip install "py-gfm<1"
$ pip list
...
Markdown                  2.6.11
py-gfm                    0.1.4
...
zopieux commented 4 years ago

I believe this was introduced by 910aa5c6227635ed27ef055c24c5c3878ed4f200. Please use mdx_gfm instead.

$ python -m markdown -x mdx_gfm
this is a test

- [ ] foo
- [x] bar
^D

<p>this is a test</p>
<ul>
<li><input disabled="disabled" type="checkbox" /> foo</li>
<li><input checked="checked" disabled="disabled" type="checkbox" /> bar</li>
</ul>