We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent 84b098d commit 19eaf23Copy full SHA for 19eaf23
coderbot/camera.py
@@ -213,8 +213,11 @@ def get_photo_thumb_file(self, filename):
213
214
def delete_photo(self, filename):
215
logging.info("delete photo: %s", filename)
216
- os.remove(PHOTO_PATH + "/" + filename)
217
- os.remove(PHOTO_PATH + "/" + filename[:filename.rfind(".")] + PHOTO_THUMB_SUFFIX + self._camera.PHOTO_FILE_EXT)
+ try:
+ os.remove(PHOTO_PATH + "/" + filename)
218
+ os.remove(PHOTO_PATH + "/" + filename[:filename.rfind(".")] + PHOTO_THUMB_SUFFIX + self._camera.PHOTO_FILE_EXT)
219
+ except FileNotFoundError:
220
+ logging.warning("photo not found: %s", filename)
221
for photo in self._photos:
222
if photo["name"] == filename:
223
self._photos.remove(photo)
0 commit comments