Python sphinx命令缺少conf文件
当我运行Python sphinx命令缺少conf文件,python,python-sphinx,tox,Python,Python Sphinx,Tox,当我运行tox命令为我的Python项目生成Sphinx文档时,我遇到了问题。以下是错误: docs runtests: PYTHONHASHSEED='1181019260' docs runtests: commands[0] | sphinx-build -W -b html -c ./conf.py -d /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/doctrees . /Users/rakesh.kumar
tox
命令为我的Python项目生成Sphinx
文档时,我遇到了问题。以下是错误:
docs runtests: PYTHONHASHSEED='1181019260'
docs runtests: commands[0] | sphinx-build -W -b html -c ./conf.py -d /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/doctrees . /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/html
Error: Config directory doesn't contain a conf.py file.
ERROR: InvocationError: '/Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/bin/sphinx-build -W -b html -c ./conf.py -d /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/doctrees . /Users/rakesh.kumar/ll/client-location/limekiln/.tox/docs/tmp/html'
_________________________________________________ summary __________________________________________________
py27: commands succeeded
lint: commands succeeded
ERROR: docs: commands failed
它基本上是在抱怨conf.py
,但是这个配置文件存在于tox.ini
所在的目录中。我是新来的tox
和sphinx
,不知道它为什么抱怨。
这是tox.ini的内容
[tox]
envlist = py27,lint,docs
[testenv]
commands =
python setup.py nosetests --with-coverage --cover-package=limekiln --cover-erase --cover-html
python setup.py sdist
deps =
setuptools>=17.1
[testenv:docs]
basepython=python
changedir=docs
deps=sphinx
commands=
sphinx-build -W -b html -c ./conf.py -d {envtmpdir}/doctrees . {envtmpdir}/html
[testenv:lint]
commands=flake8 --max-line-length 99 limekiln
basepython=python2.7
deps=
flake8
flake8-print
这是我的conf.py
文件
import sys, os
sys.path.insert(0, os.path.abspath('extensions'))
extensions = ['sphinx.ext.autodoc', 'sphinx.ext.doctest', 'sphinx.ext.todo',
'sphinx.ext.coverage', 'sphinx.ext.pngmath', 'sphinx.ext.ifconfig',
'epub2', 'mobi', 'autoimage', 'code_example', 'sphinx.ext.autodoc']
todo_include_todos = True
templates_path = ['_templates']
source_suffix = '.rst'
master_doc = 'index'
exclude_patterns = []
add_function_parentheses = True
#add_module_names = True
#modindex_common_prefix = []
project = u'Limekiln'
copyright = u'2015'
version = '1.0'
release = '1.0'
这是我的项目的目录结构
Project-root-directory
├── conf.py
├── module directory
│ ├── module sub-directory1
│ ├── module sub-directory2
├── requirements.txt
├── setup.py
└── tox.ini
改变
commands=
sphinx-build -W -b html -c ./conf.py -d {envtmpdir}/doctrees . {envtmpdir}/html
到
从sphinx构建帮助:
-c <path> path where configuration file (conf.py) is located
-c配置文件(conf.py)所在的路径
意思是,这是文件夹路径,而不是配置文件路径。我试过了,但仍然出现相同的错误。树/Users/rakesh.kumar/ll/client location/limekiln/.tox/docs/tmp/html错误:配置目录不包含conf.py文件。
它只在我指定绝对路径时对我有效。如果tox.ini
和conf.py
在同一目录中,为什么会有changedir
指令?
-c <path> path where configuration file (conf.py) is located