首页 文章

为什么sphinx conf.py在尝试导入sys时出错

提问于
浏览
0

我正在尝试使用sphinx和autodoc创建一个简单的文档,但autodoc无法影响我的模块 . 图是因为我没有在conf.py中将模块的路径添加到sys路径中

所以我在conf.py的开头添加了这个:

import sys
 import os
 sys.path.insert(0, os.path.abspath('.'))

现在我在导入sys的行上得到以下错误,我不知道为什么,因为我有与sphinxs示例中相同的代码 .

Configuration error:
There is a syntax error in your configuration file: bad input (conf.py, line 20)
Did you change the syntax from 2.x to 3.x?

第20行是导入sys的行,之前它只是自动生成的注释

1 回答

  • 0

    自动生成的注释代码在代码和注释符号#之间有一个空格,我没有注意到 .

相关问题