diff --git a/management/mail_log.py b/management/mail_log.py index c15c444a..1a601d25 100755 --- a/management/mail_log.py +++ b/management/mail_log.py @@ -72,9 +72,8 @@ def scan_files(collector): if not os.path.exists(fn): continue if fn[-3:] == '.gz': - with tempfile.NamedTemporaryFile(delete=False) as tmp_file: - with gzip.open(fn, 'rb') as f: - shutil.copyfileobj(f, tmp_file) + with tempfile.NamedTemporaryFile(delete=False) as tmp_file, gzip.open(fn, 'rb') as f: + shutil.copyfileobj(f, tmp_file) if VERBOSE: print("Processing file", fn, "...")