summaryrefslogtreecommitdiff
path: root/raphodo/renameandmovefile.py
diff options
context:
space:
mode:
Diffstat (limited to 'raphodo/renameandmovefile.py')
-rwxr-xr-xraphodo/renameandmovefile.py17
1 files changed, 13 insertions, 4 deletions
diff --git a/raphodo/renameandmovefile.py b/raphodo/renameandmovefile.py
index 2da31cc..9893688 100755
--- a/raphodo/renameandmovefile.py
+++ b/raphodo/renameandmovefile.py
@@ -36,6 +36,9 @@ import logging
import pickle
import sys
from typing import Union, Tuple, Dict, Optional
+import locale
+# Use the default locale as defined by the LANG variable
+locale.setlocale(locale.LC_ALL, '')
from gettext import gettext as _
@@ -327,10 +330,15 @@ class RenameMoveFileWorker(DaemonProcess):
rpd_file.status = DownloadStatus.download_failed
- logging.error(
- "Failed to create file %s: %s %s", rpd_file.download_full_file_name,
- inst.errno, inst.strerror
- )
+ try:
+ msg = "Failed to create file {}: {} {}".format(
+ rpd_file.download_full_file_name, inst.errno, inst.strerror
+ )
+ logging.error(msg)
+ except AttributeError:
+ logging.error(
+ "Failed to create file %s: %s ", rpd_file.download_full_file_name, str(inst)
+ )
def download_file_exists(self, rpd_file: Union[Photo, Video]) -> bool:
"""
@@ -732,6 +740,7 @@ class RenameMoveFileWorker(DaemonProcess):
else:
self.notify_download_failure_file_error(rpd_file, inst)
except Exception as inst:
+ # all other errors, including PermissionError
self.notify_download_failure_file_error(rpd_file, inst)
if add_unique_identifier: