OSError - Directory exists so capture fails on startup

Issue #6 new
Michael Hang
created an issue

I have my RPi set to run the python script on autologin but it seems like when it isn't shut down properly with sudo shutdown "now", the next time I boot it up I get the following error.

File "raspiLapse.py", line 21, in <module>
OSError: [Errno 17] File exists: 'timelapse_201404060840"

How do I add code to check if the directory already exists, and if it does add an incremental number to the end of the new directory name? For example: "timelapse_201404060840_1"

Comments (1)

  1. James Moore repo owner

    Think this might be to do with either missing time update due to lack of Network connectivity... or too close between restarts (same time). An option might be to add seconds into the time so the chances of it being the same are minimised.

  2. Log in to comment