Skip to content

Pelican can't pickle cache: TypeError: can't pickle 'generator' object #2905

@GiovanH

Description

@GiovanH
  • I have read the Filing Issues and subsequent “How to Get Help” sections of the documentation.
  • I have searched the issues (including closed ones) and believe that this is not a duplicate.
  • OS version and name: Windows 10
  • Python version: 3.8.5
  • Pelican version: git/master

Issue

When enabling caching on windows, Pelican is unable to save the caches as pickles because they apparently contain generators.

Cache configuration looks like

CACHE_CONTENT = True
CHECK_MODIFIED_METHOD = 'mtime'
# LOAD_CONTENT_CACHE = True

(Using #2904 to get output)

WARNING: Could not save cache cache\ArticlesGenerator-Readers
  |  ... cannot pickle 'generator' object

What's strange about this is there don't seem to actually be any generators in the cache. If I look at the self._cache object save_cache is trying to pickle, it just looks like a map between filename strings and values like this:

dict_values([(1626146886.6559033, ('Article Text', {'title': 'article title', 'date': SafeDatetime(2021, 7, 10, 0, 0), 'category': <Category 'categoryname'>, 'status': 'published', 'tags': [<Tag 'tagname'>]}))])

This doesn't seem to be a duplicate of #2400, as this has nothing to do with threading or watchers. It's just failing to pickle a boring object.

Metadata

Metadata

Assignees

Labels

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions