pelican-plugins / photos

Pelican plugin that adds photos to articles

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

KeyError: 'PHOTO_EXIF_KEEP'

g40 opened this issue · comments

Attempting to embed the simplest example into a Pelican markdown article, I get the error log shown below. pelican-photos installed via pip.

Can anyone explain what I am missing?

Checking further, pelican appears to be generating HTML with the gallery embedded but with links to a non-existent folder.

image

Directory structure is:

content/
    article.md
    galleries/
        from-film/
           team-90.jpg
           (more .jpg files)       

In pelicanconf.py I've got this directive block:

PLUGINS = ['photos']
PHOTO_LIBRARY = "./content/galleries" 
#PHOTO_GALLERY = (1024, 768, 80)
#PHOTO_INLINE_GALLERY_ENABLED = True
#  explicitly setting this key has zero effect.
#PHOTO_EXIF_KEEP = False

In the article.md I've got this:

Title: Photo gallery
Date: 2023-09-20 23:00
Summary: How to do pictures
Category: Gallery 
Gallery: {photo}from-film/

### Photo gallery ###

image: {photo}/from-film/team-90.jpg

Running on Windows 10 21H2.

>python --version
Python 3.11.4

>pelican --version
4.8.0

>pip install pelican-photos
Requirement already satisfied: pelican-photos in r:\apps\python\lib\site-packages (1.4.0)

Error log when attempting to build:

r:\src\web\test.tld.com>make html
"pelican" "r:/src/web/test.tld.com/content" -o "r:/src/web/test.tld.com/output" -s "r:/src/web/test.tld.com/pelicanconf.py"
[19:11:05] WARNING  Docutils has no localization for 'english'. Using 'en' instead.                log.py:91
[19:11:06] ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           WARNING  photos: An exception occurred                                                  log.py:91
                    multiprocessing.pool.RemoteTraceback:
                    """
                    Traceback (most recent call last):
                      File "R:\apps\python\Lib\multiprocessing\pool.py", line 125, in worker
                        result = (True, func(*args, **kwds))
                                        ^^^^^^^^^^^^^^^^^^^
                      File "R:\apps\python\Lib\site-packages\pelican\plugins\photos\photos.py",
                    line 1023, in process
                        if pelican_settings["PHOTO_EXIF_KEEP"] and "exif" in image.info:
                           ~~~~~~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^
                    KeyError: 'PHOTO_EXIF_KEEP'
                    """

                    The above exception was the direct cause of the following exception:

                    KeyError: 'PHOTO_EXIF_KEEP'
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
           ERROR    photos: 'PHOTO_EXIF_KEEP'                                                      log.py:96
Done: Processed 2 articles, 0 drafts, 0 hidden articles, 0 pages, 0 hidden pages and 0 draft pages in 1.36
seconds.

Same issue here.

Hi
I got a similar issue previously and my investigations led me to an issue related to multiprocessing in python on Windows machine only.

My workaround has been to disable the multiprocessing by setting PHOTO_RESIZE_JOBS = -1. Please try it and let us know.

Some links :

Please note that this issue should be fixed with pelican-photos v1.5.0 (PR here). You can try bumping your current version instead of using the workaround I mentioned above.

@canut Thank you! I confirm that adding this directive to pelicanconf.py this fixes the problem on Windows 10.

As per the discussion above, it appears that this issue has already been addressed in a shipped release of this plugin.