How to solve the module name conflict between self-defined modules and python modules

703 views
Skip to first unread message

Alicia

unread,
Aug 12, 2019, 11:47:10 PM8/12/19
to sphinx-users
During using sphinx to generate autodoc for out project, it comes out a problem that it will generate the doc for python instead of my own defined module when they have the same names.
For details, i have a module named "array.py" and when i am using "sphinx-apidoc -o XXX ../src/", the generated array.rst is as follows:

array module
============

.. automodule:: array
   :members:
   :undoc-members:
   :show-inheritance:

And when i using the command " make html " to generate the html files for all the modules, the contents of array.html is not based on my own module, but the module in python3.6.

I have tried some solutions like remove the python package in sys.path defined in config.py which throws another error as sphinx depends on some modules in python. The only solution that worked is to change the module name. 

I want to know that is there any different solution to this problem? like adding some constrains in some config files, instead of changing my modules' name.  

phy Khmer

unread,
Nov 8, 2019, 1:32:41 PM11/8/19
to sphinx-users

phy Khmer

unread,
Nov 8, 2019, 1:34:37 PM11/8/19
to sphinx...@googlegroups.com

Phykhmer

Message has been deleted

Komiya Takeshi

unread,
Nov 16, 2019, 10:38:25 PM11/16/19
to sphinx...@googlegroups.com
Hi,

How about adding the module path `../src` to the top of `sys.path`?
Autodoc extension builds document from python module. So the order of
import paths is very important.

Thanks,
Takeshi KOMIYA

2019年8月13日(火) 12:47 Alicia <alici...@gmail.com>:
> --
> You received this message because you are subscribed to the Google Groups "sphinx-users" group.
> To unsubscribe from this group and stop receiving emails from it, send an email to sphinx-users...@googlegroups.com.
> To view this discussion on the web visit https://groups.google.com/d/msgid/sphinx-users/c609cf88-ec77-4a69-8898-c28496034311%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages