More precise exception handling

In python2 OSError and IOError are different for no good reason, in
python3 IOError is an alias for OSError.
This commit is contained in:
Jeremie Courreges-Anglas 2018-05-16 17:35:31 +02:00 committed by Denis Cardon
parent 10001a6b74
commit 8ab66245ff

View File

@ -374,7 +374,7 @@ def main():
hdlr = logging.FileHandler(os.path.join(log_dir,'tisbackup_%s.log' % (backup_start_date)))
hdlr.setFormatter(logging.Formatter('%(asctime)s %(levelname)s %(message)s'))
logger.addHandler(hdlr)
except Exception, e:
except IOError, e:
if action == 'cleanup' and e.errno == errno.ENOSPC:
logger.warning("No space left on device, disabling file logging.")
else: