health-dev
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Health-dev] Modules path


From: p . rosik
Subject: [Health-dev] Modules path
Date: Wed, 19 Jul 2023 19:39:08 +0200
User-agent: SOGoMail 5.8.4

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'.

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
reply via email to

[Prev in Thread] Current Thread [Next in Thread]