Anderiel
Anderiel

Reputation: 181

Why does sphinx conf.py gives me an error for trying to import sys

I am trying to create a simple documentation with sphinx and autodoc, but the autodoc could not improt my modules. Figure that is because i did not add the path to the modules into sys path in conf.py

So i went and add this at the start of conf.py:

 import sys
 import os
 sys.path.insert(0, os.path.abspath('.'))

and now i am getting the following error on the line with import sys and i have no idea why,since i have the same code as in sphinxs example.

Configuration error:
There is a syntax error in your configuration file: bad input (conf.py, line 20)
Did you change the syntax from 2.x to 3.x?

line 20 is the line with import sys, before it are only autogenerated comments

Upvotes: 1

Views: 3542

Answers (2)

myamulla_ciencia
myamulla_ciencia

Reputation: 1488

In conf.py, after removing spaces before import statements it's working as expected

Upvotes: 0

Anderiel
Anderiel

Reputation: 181

Autogenerated commented code had one space between the code and the comment symbol # which i did not notice.

Upvotes: 2

Related Questions