Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

FileNotFoundError #4

Closed
ams0 opened this issue Mar 7, 2023 · 3 comments
Closed

FileNotFoundError #4

ams0 opened this issue Mar 7, 2023 · 3 comments

Comments

@ams0
Copy link

ams0 commented Mar 7, 2023

I run photog in a docker container (python:3 and then just pip install photog), mounting a directory from the host. The files are simply named CK-20230224-kubernetes_3.5-11715.jpg; after running photog I get:

root@04184f3b7387:/photos# photog .
Traceback (most recent call last):
  File "/usr/local/bin/photog", line 10, in <module>
    photog.create_website(root[0])
  File "/usr/local/lib/python3.11/site-packages/photog/__init__.py", line 40, in create_website
    photos = rename_images(dir)
             ^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/photog/__init__.py", line 56, in rename_images
    im = Image.open(os.path.join(dir, image))
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/usr/local/lib/python3.11/site-packages/PIL/Image.py", line 3227, in open
    fp = builtins.open(filename, "rb")
         ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: './CK-20230223-kubernetes_3.5-11065.jpg'

and files renamed to _CK-20230223-kubernetes_3.5-11065.jpg. Not sure how to fix this..

@JaapJoris
Copy link
Member

Hi, and thanks for reporting this bug!

The files are simply named CK-20230224-kubernetes_3.5-11715.jpg

Photog! attempts to rename all images to 1.jpg, 2.jpg, 3.jpg, etc. The bug is that it detects the "basename" wrong; instead of CK-20230224-kubernetes_3.5-11715 + .jpg it thinks your images are named CK-20230224-kubernetes_3 + .5-11715.jpg.

After it crashed, you were left with a bunch of "half-renamed" images. My apologies. I do not plan on fixing this bug soon, but I would welcome a PR that fixes it 🤗

@ams0
Copy link
Author

ams0 commented Mar 7, 2023

ah! Let me rename the files and check

@ams0
Copy link
Author

ams0 commented Mar 7, 2023

Done! Yes, naming is picky, perhaps amending the Readme can help here. The site is live here: https://cloudnative.amsterdam/images/album/2023/photos/

And thanks a ton!

@ams0 ams0 closed this as completed Mar 7, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants