From 7d1a04b0fec9439e1898601b7ebece19bb09ece9 Mon Sep 17 00:00:00 2001 From: Nicolas F Date: Fri, 28 Jun 2019 13:24:48 +0200 Subject: [PATCH] genPOI: hopefully fix binary string nonsense Somebody reported that genPOI was throwing an exception in two different places related to trying to read bytes as a string. I personally could not reproduce (possibly needs some special player names or something?) but I think this change should fix it either way. --- overviewer_core/aux_files/genPOI.py | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/overviewer_core/aux_files/genPOI.py b/overviewer_core/aux_files/genPOI.py index c1532a4..3841f04 100755 --- a/overviewer_core/aux_files/genPOI.py +++ b/overviewer_core/aux_files/genPOI.py @@ -230,7 +230,7 @@ class PlayerDict(dict): if os.path.exists(cache_file): try: with closing(gzip.GzipFile(cache_file)) as gz: - cls.uuid_cache = json.load(gz) + cls.uuid_cache = json.loads(gz.read().decode("utf-8")) logging.info("Loaded UUID cache from %r with %d entries.", cache_file, len(cls.uuid_cache.keys())) except (ValueError, IOError): @@ -279,7 +279,7 @@ class PlayerDict(dict): pass try: - profile = json.loads(urllib.request.urlopen(UUID_LOOKUP_URL + sname).read()) + profile = json.loads(urllib.request.urlopen(UUID_LOOKUP_URL + sname).read().decode("utf-8")) if 'name' in profile: profile['retrievedAt'] = time.mktime(time.localtime()) PlayerDict.uuid_cache[sname] = profile