Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Sphinx documentation: ERROR: Unknown directive type "program-output"

I'm trying to create my docs with Sphinx, and now on two machines I have the exact same problem: the program-output directive does not work.

I installed Sphinx, then the programoutput extension:

$ sudo pip install sphinxcontrib-programoutput

The installation went fine, documents compile beautifully to nice looking html, but the command-output just doesn't work.

I created a super-simple test case with a file called test.rst containing a single line:

.. program-output:: python -V

Now when trying to compile this, I get the following output (path abbreviated):

/path/to/test.rst:1: ERROR: Unknown directive type "program-output".

Changing program-output to it's alias command-output doesn't work either (not surprising). I really wonder what I'm doing wrong here. I followed the installation instructions, tried it again and again, reinstalled with an --upgrade flag, nothing works.

like image 470
Wouter Avatar asked Oct 11 '12 14:10

Wouter


1 Answers

Thanks to bmu I found the problem, indeed I had to add it to the conf.py.

Now the next question: "why is this not in the installation/usage documentation of this extension?" It's not mentioned in http://packages.python.org/sphinxcontrib-programoutput/ which is the first link I get when googling for this extension.

Anyway the complete answer, hope it's useful for other people too:

Go to the document root of your documentation (e.g. ~/Projects/project-name/doc) where the rest of your documents are.

Edit file conf.py

Look for the line that says extensions = [] (an empty list in my case)

Change this to: extensions = ['sphinxcontrib.programoutput']

And miraculously it suddenly starts to work.

like image 142
Wouter Avatar answered Sep 23 '22 01:09

Wouter