我正在尝试使用Sphinx记录一个Python文件,该文件用于实现GIMP插件。问题是,当我跑步时;
make html
我收到以下消息-如下所示,会产生错误;
sphinx-build -b html -d _build/doctrees . _build/html
Running Sphinx v2.2.0
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 0 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] code
WARNING: autodoc: failed to import module 'Plugin_ImageOverlay'; the following exception was raised:
Traceback (most recent call last):
File "/home/craig/.local/lib/python3.5/site-packages/sphinx/ext/autodoc/importer.py", line 32, in import_module
return importlib.import_module(modname)
File "/usr/lib/python3.5/importlib/__init__.py", line 126, in import_module
return _bootstrap._gcd_import(name[level:], package, level)
File "<frozen importlib._bootstrap>", line 986, in _gcd_import
File "<frozen importlib._bootstrap>", line 969, in _find_and_load
File "<frozen importlib._bootstrap>", line 958, in _find_and_load_unlocked
File "<frozen importlib._bootstrap>", line 673, in _load_unlocked
File "<frozen importlib._bootstrap_external>", line 665, in exec_module
File "<frozen importlib._bootstrap>", line 222, in _call_with_frames_removed
File "/home/craig/.gimp-2.8/plug-ins/ImageOverlay/Plugin_ImageOverlay.py", line 73, in
<module>
from gimpfu import register, main, pdb, gimp, PF_IMAGE, PF_DRAWABLE, PF_INT,
PF_STRING, PF_FILE, PF_BOOL, INTERPOLATION_NONE, INTERPOLATION_LINEAR,
INTERPOLATION_CUBIC, INTERPOLATION_LANCZOS, PF_RADIO
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 235
raise error, "parameter name contains illegal characters"
^
SyntaxError: invalid syntax
looking for now-outdated files... none found
pickling environment... done
checking consistency... done
preparing documents... done
writing output... [100%] index
generating indices... genindexdone
writing additional pages... search/home/craig/.local/lib/python3.5/site-
packages/sphinx_rtd_theme/search.html:20: RemovedInSphinx30Warning: To modify script_files
in the theme is deprecated. Please insert a <script> tag directly in your theme instead.
{{ super() }}
done
copying static files... ... done
copying extra files... done
dumping search index in English (code: en)... done
dumping object inventory... done
build succeeded, 1 warning.
The HTML pages are in _build/html.
Build finished. The HTML pages are in _build/html.
如果从以上输出中看不出来,则读取错误消息;
File "/usr/lib/gimp/2.0/python/gimpfu.py", line 235
raise error, "parameter name contains tllegal characters"
^
SyntaxError: invalid syntax
我对Python或Sphinx不太了解,但是此错误与Python 2和3版本之间的语法差异有关吗? GIMP可以毫无问题地加载和执行我的插件-为什么Sphinx似乎对此感到窒息?
是否有一些我不知道的简单解决方法,例如可以放置在Sphinx的conf.py文件中的键/值对?
感谢您的协助。
您正在使用Sphinx和Sphinx dropped support for Python 2 since 2.0.x的2.2.0版本
gimpfu.py中的raise error, e
样式为not supported in Python 3.x。 (您应该使用raise error(e)
)
[您可以尝试使用支持Python 2的较旧版本的Sphinx,或入侵gimp以使用与Python 3兼容的语法,或要求gimp人员对其进行修复...