在某些 GIMP Python 插件代码上尝试 运行 Sphinx 时出错
Errors when attempting to run Sphinx on some GIMP Python Plugin code
我正在尝试使用 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 2.2.0 版,并且 Sphinx dropped support for Python 2 since 2.0.x
gimpfu.py 中的 raise error, e
样式为 not supported in Python 3.x。 (您应该使用 raise error(e)
)
您可以尝试使用支持 Python 2 的旧版本 Sphinx,或者破解 gimp 以使用 Python 3 兼容语法,或者要求 gimp 人员修复它...
我正在尝试使用 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 2.2.0 版,并且 Sphinx dropped support for Python 2 since 2.0.x
gimpfu.py 中的 raise error, e
样式为 not supported in Python 3.x。 (您应该使用 raise error(e)
)
您可以尝试使用支持 Python 2 的旧版本 Sphinx,或者破解 gimp 以使用 Python 3 兼容语法,或者要求 gimp 人员修复它...