在python-sphinx中找不到";Grammar.txt";
问题描述
在Windows下尝试使用Python Sphinx生成html文档时,出现以下错误:
IOError: [Errno 2] No such file or directory:
'c:\python27\sphinx.egg\sphinx\pycode\Grammar.txt'
但是,当我打开sphinx.egg时,文件"Grammar.txt"出现了...
这是它提供的日志
# Sphinx version: 1.1.3
# Python version: 2.7.3
# Docutils version: 0.9.1 release
# Jinja2 version: 2.6 Traceback (most recent call last):
File "c:python27sphinx.eggsphinxcmdline.py", line 188, in main
warningiserror, tags)
File "c:python27sphinx.eggsphinxapplication.py", line 114, in __init__
self.setup_extension(extension)
File "c:python27sphinx.eggsphinxapplication.py", line 247, in
setup_extension
mod = __import__(extension, None, None, ['setup'])
File "c:python27sphinx.eggsphinxextautodoc.py", line 26, in <module>
File "c:python27sphinx.eggsphinxpycode\__init__.py", line 25, in <module>
File "c:python27sphinx.eggsphinxpycodepgen2driver.py", line 126, in load_grammar
g = pgen.generate_grammar(gt)
File "c:python27sphinx.eggsphinxpycodepgen2pgen.py", line 383, in generate_grammar
p = ParserGenerator(filename)
File "c:python27sphinx.eggsphinxpycodepgen2pgen.py", line 15, in __init__
stream = open(filename) IOError: [Errno 2] No such file or directory: 'c:\python27\sphinx.egg\sphinx\pycode\Grammar.txt'
有人知道为什么吗?
解决方案
我终于找到了为什么找不到文件&Grammar.txt&。首先,我将sphinx-ickstart.exe移到了我的源文件夹中。相反,更好的方法(也是正确的做法)是从它的默认文件夹启动sphinx-ickstart.exe,然后出现以下问题:
&>输入文档的根路径。
&>文档的根路径[.]:";Path ToYourSourceFold";
在此问题中输入您的源文件夹路径。
希望这能帮助某人!
相关文章