AttributeError: type object 'MarkdownBuilder' has no attribute 'supported'
Open
matt-everett
opened this issue 6 years ago
•
18 comments
trafficstars
Hi, I'm running into a problem when I try to run this package.
I copied the conf.py example for sphinx 1.8 (I'm using 2.2) but needed to edit the example code as is seems a little out of date, it references a sphinx_markdown_parser module.
I'm running from tox with this command: -
tox sphinx-build -M markdown containers/source {env:DOC_OUTPUT_FOLDER:'build'}/containersmd
Error
Exception occurred:
File "/home/matt.everett/code/mkc/microservices/service-api/src/.tox/doc/lib/python3.7/site-packages/sphinx/registry.py", line 302, in add_source_parser
if len(parser.supported) == 0:
AttributeError: type object 'MarkdownBuilder' has no attribute 'supported'
Log
# Sphinx version: 2.2.0
# Python version: 3.7.3 (CPython)
# Docutils version: 0.13.1 release
# Jinja2 version: 2.10.1
# Last messages:
# Loaded extensions:
Traceback (most recent call last):
File "/home/matt.everett/code/mkc/microservices/service-api/src/.tox/doc/lib/python3.7/site-packages/sphinx/cmd/build.py", line 275, in build_main
args.tags, args.verbosity, args.jobs, args.keep_going)
File "/home/matt.everett/code/mkc/microservices/service-api/src/.tox/doc/lib/python3.7/site-packages/sphinx/application.py", line 250, in __init__
self.config.setup(self)
File "/home/matt.everett/code/mkc/microservices/service-api/src/doc/containers/source/conf.py", line 63, in setup
app.add_source_parser(MarkdownBuilder)
File "/home/matt.everett/code/mkc/microservices/service-api/src/.tox/doc/lib/python3.7/site-packages/sphinx/application.py", line 1133, in add_source_parser
self.registry.add_source_parser(*args, **kwargs)
File "/home/matt.everett/code/mkc/microservices/service-api/src/.tox/doc/lib/python3.7/site-packages/sphinx/registry.py", line 302, in add_source_parser
if len(parser.supported) == 0:
AttributeError: type object 'MarkdownBuilder' has no attribute 'supported'
@codejamninja, thanks for your response. Currently the code is deeply entrenched in a big proprietary codebase :( I'm going to try to put together a demo of the problem in a smaller package to make it possible to share. I'll hopefully get some time to work on it soon!
if len(parser.supported) == 0:
warnings.warn('Old source_parser has been detected. Please fill Parser.supported '
'attribute: %s' % parser.__name__,
RemovedInSphinx30Warning, stacklevel=3)
Clearly the parser API has changed (recently?). Unfortunately, their own error catching is failing a bit...
Actually, yes. Why do you even have this code on the front page? I mean, all of that is to register a markdown parser, ie. to read markdown source files. And the point of this project is to build markdown output, no?
I removed all of that from my conf.py, ran "make markdown" and got the .md files I wanted as output...
I've just tried @SwampFalc's advice (make markdown) and it does indeed build the output I want ... thanks very much!
It didn't convert the tables quite correctly but I'll raise a separate issue for that :)
@codejamninja do you still think this issue is relevant? It sounds like the docs need updating, but is the parser scenario relevant to your project if it's already producing markdown output? Would you prefer me to close this or do you want to continue tracking it?
I can confirm this issue still exists with sphinx-build -M markdown <source dir> <output dir>. For my case, I cannot use make markdown because I need to call upon the sphinx module through python.
I have tested on both sphinx 2.0.0 and 1.8.0. Neither works and fails with the same issue that is stated by @matt-everett and @SwampFalc.
I'm really busy. I will try to get to it before the holidays. If you want to did into it feel free to. I just pinned this issue so I don't forget about it.
The solution is to remove everything you added to your conf.py. None of it
is needed for the correct operation of this module, it's a leftover from
another module ( that I assume was forked to start this).
DISCONTINUED: This project is no longer maintained. The active version of this project is now being maintained at liran-funaro/sphinx-markdown-builder.