I'm trying to implement one of the answers to this question. However, I haven't been successful because when I run
> sphinx-autogen -o generated *.rst
I get the errors
Failed to import 'MyMod.X': no module named MyMod.X
Failed to import 'MyMod.Y': no module named MyMod.Y
Failed to import 'MyMod.Z': no module named MyMod.Z
Within my .rst
files, there is one with the line:
.. automodule:: MyMod.X
(and similarly for MyMod.Y
and MyMod.Z
).
I'm running this within a subdirectory docs
. In the parent directory containing docs
, there is also a subdirectory MyMod
which contains __init__.py
, X.py
, Y.py
, and Z.py
. The conf.py
file within docs
has the line sys.path.insert(0, os.path.abspath('../'))
immediately after import sys
.
The closest related question I can find is this, but the answers there seem to suggest that it is solved by inserting '../'
into the path, which I had already done. Also, sphinx-autobuild
can find these modules happily, so I don't think this is the issue.
Interestingly, changing the line in my .rst
file to be .. automodule:: ../MyMod.X
gets rid of the error message, though nothing seems to be generated in the directory I expect, and I then get error messages in sphinx-autobuild
.
How can I get sphinx-autogen
to read in these modules?