Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unknown directive type "toctree". Error in Pycharm, but index.html works

When working in PyCharm, the preview mode of the document I am creating in Sphinx shows:

System Message: ERROR/3 (<stdin>, line 9)

Unknown directive type "toctree".

..toctree::
 :maxdepth: 2

file1
file2

I have included the autodoc extension in my conf.py file. When I open the /build/index.html file, it works fine however. My question thus is: How can I remove this error from the PyCharm preview mode, so that I can preview my document without having to open the /build/index.html file all the time?

like image 942
Wouter Avatar asked Nov 03 '18 11:11

Wouter


1 Answers

Sphinx is built on top of the Docutils library. The toctree directive works with Sphinx, but it is not recognized by Docutils.

The PyCharm previewer does not use Sphinx (this is true for the free community edition and for Professional editions as of 2019); it likely uses rst2html.py from Docutils.

This mailing list thread is about the same error: https://web.archive.org/web/20180715103227/https://mail.python.org/pipermail/python-list/2008-June/493826.html

like image 166
mzjn Avatar answered Nov 09 '22 00:11

mzjn