revert using json.dump

windows encodings dont like the weird characters
This commit is contained in:
A_D authored and Athanasius committed 2020-07-26 23:08:47 +01:00
1 parent 0e0c802b04
commit f08d60d9b1
1 file changed
+4 -8
+4 -8
View File
@@ -91,10 +91,8 @@ def main():
newversion: Optional[EDMCVersion] = updater.check_appcast()
if newversion:
print(f'{appversion} ({newversion.title!r} is available)')
else:
print(appversion)
sys.exit(EXIT_SUCCESS)
if args.j:
@@ -106,9 +104,7 @@ def main():
# Get state from latest Journal file
try:
logdir = config.get('journaldir') or config.default_journal_dir
logfiles = sorted(
(x for x in os.listdir(logdir) if JOURNAL_RE.search(x)), key=lambda x: x.split('.')[1:]
)
logfiles = sorted((x for x in os.listdir(logdir) if JOURNAL_RE.search(x)), key=lambda x: x.split('.')[1:])
logfile = join(logdir, logfiles[-1])
@@ -116,7 +112,6 @@ def main():
for line in loghandle:
try:
monitor.parse_entry(line)
except Exception:
if __debug__:
print(f'Invalid journal entry {line!r}')
@@ -189,8 +184,9 @@ def main():
# stuff we can do when not docked
if args.d:
with open(args.d, 'w') as f:
json.dump(data, f, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': '))
out = json.dumps(data, ensure_ascii=False, indent=2, sort_keys=True, separators=(',', ': '))
with open(args.d, 'wb') as f:
f.write(out.encode("utf-8"))
if args.a:
loadout.export(data, args.a)