From 21f709c707c54cbec12def2e53973ab9fb7795a5 Mon Sep 17 00:00:00 2001 From: gauthiier Date: Mon, 9 Dec 2019 14:22:26 +0100 Subject: [PATCH] tm20 utf-8 [ready for rene] --- selection/sel.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/selection/sel.py b/selection/sel.py index 855692c..230859c 100644 --- a/selection/sel.py +++ b/selection/sel.py @@ -5,7 +5,7 @@ EXP = "selection/" sel = os.path.join(EXP, "tm-selection.js") sel_dump = os.path.join(EXP, "tm-selection-dump.js") -with open(sel) as f: +with open(sel, encoding='utf-8') as f: d = json.load(f) def lists(): @@ -28,7 +28,7 @@ def find(li, url): dir_files = [f for f in glob.glob(os.path.join(d, "*.json"))] for f in dir_files: - with open(f) as fp: + with open(f, encoding='utf-8') as fp: dj = json.load(fp) for t in dj['threads']: if t['url'] == url: # one level..... not recursive @@ -67,7 +67,7 @@ def commit_dump(li, url, tag): m = find(li, url) # <--- time if m is not None: - with open(sel_dump) as f: + with open(sel_dump, encoding='utf-8') as f: dump = json.load(f) if tag not in list(dump.keys()): @@ -87,7 +87,7 @@ def commit_dump(li, url, tag): def commit_from_selection(): dump = {} - with open(sel) as f: + with open(sel, encoding='utf-8') as f: d = json.load(f) for k, v in d.items(): @@ -132,7 +132,7 @@ def recursive_format(msg): def format_selection(): - with open(sel_dump) as f: + with open(sel_dump, encoding='utf-8') as f: d = json.load(f) for k, v in d.items(): @@ -148,7 +148,7 @@ def recursive_hashmap(msg, tag, hm): recursive_hashmap(i, tag, hm) def hashmap(): - with open(sel_dump) as f: + with open(sel_dump, encoding='utf-8') as f: d = json.load(f) hm = {} for k, v in d.items():