导致操作系统的Sphinx错误

时间:2014-07-09 12:06:34

标签: python python-sphinx

我目前正在使用Sphinx和我的项目。我的项目设置如下:

Orpheus/
    docs/
        build/
            ...
        source/
            conf.py
            index.rst
            ...
        ...
    Orpheus/
        Utils/
            __init__.py
            ...
        __init__.py
        Orpheus.pyx
    setup.py

docs文件夹是我基于Sphinx文件的地方。我为Orpheus包添加了sys.path的相应路径。这是:

sys.path.insert(0, os.path.abspath('../../Orpheus'))
sys.path.insert(0, os.path.abspath('../../Orpheus/Utils'))

使用autodoc我正在尝试使用以下文档将Orpheus.pyx文档添加到index.rst中:

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

当我使用make html时,我得到以下追溯:

C:\Users\Robert\PycharmProjects\Orpheus\docs\source\index.rst:14: WARNING: autodoc: failed to import module 'Orpheus'; the follo
wing exception was raised:
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\sphinx-1.3a0dev_20140708-py3.4.egg\sphinx\ext\autodoc.py", line 368, in import_object
    __import__(self.modname)
  File "Orpheus.pyx", line 1, in init Orpheus.Orpheus (Orpheus\Orpheus.c:3370)
    import os
SystemError: Parent module '' not loaded, cannot perform relative import

我尝试将文档字符串添加到Orpheus.pyx的顶部,但我仍然收到错误:

C:\Users\Robert\PycharmProjects\Orpheus\docs\source\index.rst:14: WARNING: autodoc: failed to import module 'Orpheus'; the follo
wing exception was raised:
Traceback (most recent call last):
  File "C:\Python34\lib\site-packages\sphinx-1.3a0dev_20140708-py3.4.egg\sphinx\ext\autodoc.py", line 368, in import_object
    __import__(self.modname)
  File "Orpheus.pyx", line 1, in init Orpheus.Orpheus (Orpheus\Orpheus.c:3370)
    """
SystemError: Parent module '' not loaded, cannot perform relative import

我之前从未使用过狮身人面像所以我不确定这里有什么问题。有没有解决这个问题?我正在使用Python 3.4 Sphinx v1.3a0

0 个答案:

没有答案