diff options
Diffstat (limited to 'MgaRepo')
-rw-r--r-- | MgaRepo/binrepo.py | 2 | ||||
-rw-r--r-- | MgaRepo/log.py | 11 |
2 files changed, 6 insertions, 7 deletions
diff --git a/MgaRepo/binrepo.py b/MgaRepo/binrepo.py index f14de52..89679b0 100644 --- a/MgaRepo/binrepo.py +++ b/MgaRepo/binrepo.py @@ -125,7 +125,7 @@ def import_binaries(topdir, pkgname): def parse_sources(path): entries = {} try: - f = open(path) + f = open(path, encoding="utf-8") except IOError: return [] 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) |