jim-easterbrook / python-gphoto2

Python interface to libgphoto2
GNU Lesser General Public License v3.0
357 stars 59 forks source link

Break from 'while True' if no files left to delete #127

Closed greiginsydney closed 2 years ago

greiginsydney commented 2 years ago

clear-space.py holds in a loop forever if you request more space be made than there are images on the camera.

This is probably only apparent if you run the script with the intent of deleting all images: 100 (%).

Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space
Camera has 99.5% free space

... you get the gist.

This is a simple fix, but I think is sufficient? By all means reject and re-write if you'd prefer to see it done differently.

- G.

greiginsydney commented 2 years ago

https://github.com/greiginsydney/Intervalometerator/issues/91

jim-easterbrook commented 2 years ago

Thanks. As you can guess, I'd never tried it on a nearly empty camera. I'd have changed line 96 from while True: to while files: but your change is just as effective.