Hi, Patrick
On July 19, 2023 6:39:08 PM GMT+01:00, "p.ro...@stud.uni-hannover.de" <p.ro...@stud.uni-hannover.de> wrote: > >Hello dear Gnu Health Community, > >I have another question for you guys. This one is about the Sphinx >documentation and especially specifying the path in the "conf.py". I am now >trying to generate my documentation of the modules health_imaging and >health_orthanc via autodoc respectively sphinx-apidoc and unfortunately the >error occurs: > WARNING: autodoc: failed to import module 'x' from module 'modules'; the >following exception was raised: No module named 'modules'. Check the env variable PYTHONPATH If you use the vanilla installation, the bashrc profile has an example on how to use it. Bests Luis > >I have tried several things. >https://www.sphinx-doc.org/en/master/man/sphinx-apidoc.html >As a "gnuhealth" user and in the "venv" environment under >/opt/gnuhealth/venv/lib/.../trytond/modules --> "sphinx-apidoc -F -a -o docs . >" tried. > >Then also tried recursively adding each path from trytond to the generated >"conf.py": >def add_subdirectories_to_path(directory): > for root, dirs, _ in os.walk(directory): > for d in dirs: > sys.path.insert(0, os.path.abspath(os.path.join(root, d))) > >add_subdirectories_to_path('/opt/gnuhealth/venv/lib/python3.10/site-packages/trytond/') > >Tried it again also to do that directly in "trytond" that pretty sure all >dependencies are accounted for. Is any of you maybe familiar with what the >path needs to look like. Believe this is the reason it is not working. The way >I read it, every import must be reachable. > >(Using sphinx-apidoc -F -a -o docs . in .../trytond/modules) >index.rst contains: >Welcome to modules's documentation! >=================================== > >.. toctree:: > :maxdepth: 4 > :caption: Contents: > > modules > >modules.rst contains: >modules package >=============== > >Subpackages >------------------ > >.. toctree:: > :maxdepth: 4 > > modules.account > (... other modules) > >Module contents >---------------------- > >.. automodule:: modules > :members: > :undoc-members: > :show-inheritance: > > >conf.py contains: >import os >import sys >#def add_subdirectories_to_path(directory): ># for root, dirs, _ in os.walk(directory): ># for d in dirs: ># sys.path.insert(0, os.path.abspath(os.path.join(root, d))) > >#add_subdirectories_to_path('/opt/gnuhealth/venv/lib/python3.10/site-packages/trytond/') > (tried it with and without this) >sys.path.insert(0, >'/opt/gnuhealth/venv/lib/python3.10/site-packages/trytond/modules') > >Am grateful for any ideas. > >Best regards, >Patryk -- Sent from my Android device with K-9 Mail. Please excuse my brevity.