diff --git a/legendary/cli.py b/legendary/cli.py index 9d246da..ec42d04 100644 --- a/legendary/cli.py +++ b/legendary/cli.py @@ -932,7 +932,7 @@ class LegendaryCLI: # always write repair file, even if all match if repair_file: repair_filename = os.path.join(self.core.lgd.get_tmp_path(), f'{args.app_name}.repair') - with open(repair_filename, 'w') as f: + with open(repair_filename, 'w', encoding='utf-8') as f: f.write('\n'.join(repair_file)) logger.debug(f'Written repair file to "{repair_filename}"') diff --git a/legendary/downloader/mp/manager.py b/legendary/downloader/mp/manager.py index eb1c817..846d8c5 100644 --- a/legendary/downloader/mp/manager.py +++ b/legendary/downloader/mp/manager.py @@ -113,7 +113,7 @@ class DLManager(Process): mismatch = 0 completed_files = set() - for line in open(self.resume_file).readlines(): + for line in open(self.resume_file, encoding='utf-8').readlines(): file_hash, _, filename = line.strip().partition(':') _p = os.path.join(self.dl_dir, filename) if not os.path.exists(_p): @@ -527,8 +527,8 @@ class DLManager(Process): file_hash = self.hash_map[res.filename] # write last completed file to super simple resume file - with open(self.resume_file, 'ab') as rf: - rf.write(f'{file_hash}:{res.filename}\n'.encode('utf-8')) + with open(self.resume_file, 'a', encoding='utf-8') as rf: + rf.write(f'{file_hash}:{res.filename}\n') if not res.success: # todo make this kill the installation process or at least skip the file and mark it as failed