从Sphinx文件中以.rst格式导入多个表

时间:2019-04-08 20:20:44

标签: python python-sphinx restructuredtext

我想在单个.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中,它们将可以正常工作。但这不是我所需要的。上面的消息对我来说似乎是一个狮身人面像的错误/问题。

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

1 个答案:

答案 0 :(得分:1)

可能需要更新的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