From 15741047ed9ca9935a352b199b7fe5c80c868795 Mon Sep 17 00:00:00 2001 From: Calum Lind Date: Fri, 16 Jun 2017 00:26:51 +0100 Subject: [PATCH] [Common] Catch tarfile exception if no filepaths exist --- deluge/common.py | 14 +++++++++----- 1 file changed, 9 insertions(+), 5 deletions(-) diff --git a/deluge/common.py b/deluge/common.py index a5c47706a..7320ab6c5 100644 --- a/deluge/common.py +++ b/deluge/common.py @@ -173,11 +173,15 @@ def archive_files(arc_name, filepaths): # TODO: Remove oldest timestamped archives. log.warning('More than %s tarballs in config archive', max_num_arcs) - with tarfile.open(arc_filepath, 'w:' + arc_comp) as tf: - for filepath in filepaths: - tf.add(filepath, arcname=os.path.basename(filepath)) - - return arc_filepath + try: + with tarfile.open(arc_filepath, 'w:' + arc_comp) as tf: + for filepath in filepaths: + tf.add(filepath, arcname=os.path.basename(filepath)) + except OSError: + log.error('Problem occurred archiving filepaths: %s', filepaths) + return False + else: + return arc_filepath def windows_check():