0

My project has the following structure.

Main_Folder: |---- .venv_folder |---- Documentation: |------ source |------ index.rst,conf.py, Module_1.rst, Module_2.rst |------ build |---- Modules: |------ Module_1 |------ Module_2 

In Module_1 and Module_2, I have some scripts with docstrings I want to show, in a html type of view.

In the source folder, I have

-> index.rst, with:

.. toctree:: :maxdepth: 2 Module_1 Module_2 

-> conf.py, with:

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

os.path.abspath('../..') returns ~/Main_Folder

So, I've added the directory where my modules reside to sys.path.

In Module_1.rst and Module_2.rst, I have almost the same:

Module_1 =========== .. automodule:: Module_1 :members: 

When I run sphinx-build -b html source build, after having activated the venv, I get the following:

WARNING: autodoc: failed to import module 'Module_1'; the following exception was raised: No module named 'Modules' WARNING: autodoc: failed to import module 'Module_2'; the following exception was raised: No module named 'Modules'

How do I make sphinx to detect the modules?

4
  • This error is unrelated to finding modules. It has to do with having common/doc_parsing in one of your toctrees. Commented Mar 10, 2022 at 6:33
  • @StevePiercy I've changed the question. Maybe it's improved... Commented Mar 10, 2022 at 19:58
  • @mzjn I've edited the question. Any help would be appreciated. Commented Mar 10, 2022 at 19:59
  • Ups, I just found the answer to my question: stackoverflow.com/questions/62340756/… Commented Mar 10, 2022 at 20:03

0

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.