首页 > 解决方案 > 从 .rst 格式的 Sphinx 文件中导入多个表

问题描述

我想.csv在单个.rst. 类似于下面的.rst示例:

=======
Section
=======

subsection01
------------
.. csv-table:: my_table1
   :file: my_file1.csv

subsection02
------------
.. csv-table:: my_table2
   :file: my_file2.csv

但是,这给了我一个错误:

Exception occurred:
  File "/var/jenkins_home/.local/lib/python2.7/site-packages/sphinx/environment/__init__.py", line 612, in get_doctree
    doctree = pickle.load(f)
ValueError: unsupported pickle protocol: 4
The full traceback has been saved in /tmp/sphinx-err-IQAuoY.log, if you want to report the issue to the developers.
Please also report this if it was a user error, so that a better error message can be provided next time.
A bug report can be filed in the tracker at <https://github.com/sphinx-doc/sphinx/issues>. Thanks!
Makefile:20: recipe for target 'html' failed
make: *** [html] Error 2
Build step 'Execute shell' marked build as failure
Finished: FAILURE

我不得不提到,如果我将import上面的每个块放在一个单独的.rst中,它们就会正常工作。但这不是我需要的。上面的消息对我来说似乎是一个狮身人面像的错误/问题。

对此有任何想法/解决方案吗?

标签: pythonpython-sphinxrestructuredtext

解决方案


可能需要更新版本的 Python 来读取 pickle 输出 :) Pickles 协议版本 4 看起来像是在 Python 3.4 中添加的,更新可能会起作用!

Exception occurred:
  File "/var/jenkins_home/.local/lib/python2.7/site-packages/sphinx/environment/__init__.py", line 612, in get_doctree
    doctree = pickle.load(f)
ValueError: unsupported pickle protocol: 4

推荐阅读