From d0735a6d5885d821ace5743b9ccc1bf334f5bf3b Mon Sep 17 00:00:00 2001 From: mano3m <-> Date: Sat, 20 Jul 2013 16:01:37 +0200 Subject: [PATCH] Add failsafe for symlink errors E.g. on Windows you need Admin rights to symlink... --- couchpotato/core/plugins/renamer/main.py | 6 +++++- 1 file changed, 5 insertions(+), 1 deletion(-) diff --git a/couchpotato/core/plugins/renamer/main.py b/couchpotato/core/plugins/renamer/main.py index 1121691f..d068c483 100644 --- a/couchpotato/core/plugins/renamer/main.py +++ b/couchpotato/core/plugins/renamer/main.py @@ -552,7 +552,11 @@ Remove it if you want it to be renamed (again, or at least let it try again) shutil.copy(old, dest) elif self.conf('file_action') == 'move_symlink': shutil.move(old, dest) - symlink(dest, old) + try: + symlink(dest, old) + except: + log.error('Couldn\'t symlink file "%s" to "%s". Copying the file back. Error: %s. ', (old, dest, traceback.format_exc())) + shutil.copy(dest, old) else: shutil.move(old, dest)