abakan-zz / ablog

ABlog for blogging with Sphinx
ablog.readthedocs.org
Other
122 stars 35 forks source link

PicklingError: Can't pickle class `docutils.parsers.rst.directives.html.meta` attribute lookup failed #68

Closed lakhman closed 7 years ago

lakhman commented 8 years ago

Issue: sphinx-doc/sphinx/issues/2625

I'm using ablog and trying to add some meta tags for each post using the following:

.. meta::
   :keywords: custom meta

.. post:: Feb 8, 2016
  :tags: Tag1, Tag2
  :category: Blog

  Blog content

Hello from document
================================

some text in here

When I use the meta directive, I'm throw the following (rather vague) error:

$ make html
sphinx-build -b html -d build/doctrees   source build/html
Running Sphinx v1.4.2
Initializing Spelling Checker
loading pickled environment... done
building [mo]: targets for 0 po files that are out of date
building [html]: targets for 1 source files that are out of date
updating environment: 0 added, 1 changed, 0 removed
reading sources... [100%] document                                                                                                                                                                                                   
looking for now-outdated files... none found
pickling environment... 

Exception occurred:
  File "/usr/local/lib/python2.7/site-packages/sphinx/environment.py", line 136, in topickle
    pickle.dump(self, picklefile, pickle.HIGHEST_PROTOCOL)
PicklingError: Can't pickle <class 'docutils.parsers.rst.directives.html.meta'>: attribute lookup docutils.parsers.rst.directives.html.meta failed
The full traceback has been saved in /var/folders/jy/sqr_5svd1dz6f9d6zzw_bwvh0000gn/T/sphinx-err-w6Uk50.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!
make: *** [html] Error 1

Please read the issue on sphinx for more details: sphinx-doc/sphinx/issues/2625

Any ideas on an easy fix? I can't even find the problem.

I tested this on a brand new project with sphinx-quickstart and ablog, it's definatley an issue in ablog, but I couldn't track down what.

It seems like sphinx is trying to serialize all the meta data to write to disk, but it's failing to do so with ablog (specifically the post directive), somehow we have to make the meta data stored within the sphinx environment picklable (serializable).

I'm not really a python developer (well.. I think I can call myself a noob now), but I'm struggling to traceback the issue.

I thought it could be related to this line, but again, not sure.

https://github.com/abakan/ablog/blob/devel/ablog/post.py#L223

emacsway commented 7 years ago

Any idea how to solve the issue?