CrossNox / m2r2

Markdown to reStructuredText converter
https://crossnox.github.io/m2r2
MIT License
107 stars 26 forks source link

Module 'mistune' has no attribute 'BlockGrammar' #40

Closed thmsklngr closed 2 years ago

thmsklngr commented 2 years ago

Hi,

I just wanted to generate some documentation of my current project and came across the problem mentioned in the topic. The log generated by Sphinx contains these lines:

# Sphinx version: 4.1.2
# Python version: 3.6.9 (CPython)
# Docutils version: 0.17.1 release
# Jinja2 version: 3.0.1
# Last messages:

# Loaded extensions:
Traceback (most recent call last):
  File "/path/to/.virtualenvs/idme-JkYIOqhd/lib/python3.6/site-packages/sphinx/cmd/build.py", line 279, in build_main
    args.tags, args.verbosity, args.jobs, args.keep_going)
  File "/path/to/.virtualenvs/idme-JkYIOqhd/lib/python3.6/site-packages/sphinx/application.py", line 237, in __init__
    self.setup_extension(extension)
  File "/path/to/.virtualenvs/idme-JkYIOqhd/lib/python3.6/site-packages/sphinx/application.py", line 393, in setup_extension
    self.registry.load_extension(self, extname)
  File "/path/to/.virtualenvs/idme-JkYIOqhd/lib/python3.6/site-packages/sphinx/registry.py", line 429, in load_extension
    mod = import_module(extname)
  File "/usr/lib/python3.6/importlib/__init__.py", line 126, in import_module
    return _bootstrap._gcd_import(name[level:], package, level)
  File "<frozen importlib._bootstrap>", line 994, in _gcd_import
  File "<frozen importlib._bootstrap>", line 971, in _find_and_load
  File "<frozen importlib._bootstrap>", line 955, in _find_and_load_unlocked
  File "<frozen importlib._bootstrap>", line 665, in _load_unlocked
  File "<frozen importlib._bootstrap_external>", line 678, in exec_module
  File "<frozen importlib._bootstrap>", line 219, in _call_with_frames_removed
  File "/path/to/.virtualenvs/idme-JkYIOqhd/lib/python3.6/site-packages/m2r2.py", line 83, in <module>
    class RestBlockGrammar(mistune.BlockGrammar):
AttributeError: module 'mistune' has no attribute 'BlockGrammar'

I do not know if this might be related to m2r2 or Sphinx, however, whenever I enable m2r2 as extension in Sphinx, I get this error.

Regards, Thomas

francois-maillard commented 2 years ago

Looks like it is due to mistune bumping from 0.8.4 to 2.0.0, so forcing mistune==0.8.4 is a work around.