diff options
Diffstat (limited to 'MgaRepo/log.py')
-rw-r--r-- | MgaRepo/log.py | 11 |
1 files changed, 5 insertions, 6 deletions
diff --git a/MgaRepo/log.py b/MgaRepo/log.py index fa7ac62..40302bc 100644 --- a/MgaRepo/log.py +++ b/MgaRepo/log.py @@ -553,12 +553,11 @@ def get_old_log(pkgdirurl): else: logfile = os.path.join(tmpdir, "log") if os.path.isfile(logfile): - file = open(logfile) - chlog.write("\n") # TODO needed? - log = file.read() - log = escape_macros(log) - chlog.write(log) - file.close() + with open(logfile, 'r', encoding = 'utf-8') as lf: + chlog.write("\n") # TODO needed? + log = lf.read() + log = escape_macros(log) + chlog.write(log) finally: if os.path.isdir(tmpdir): shutil.rmtree(tmpdir) |