Skip to content

Commit a37e5c4

Browse files
committed
make compatible with python3.5
1 parent b4386b0 commit a37e5c4

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

screepsapi/screepsapi.py

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,8 @@ def memory(self, path='', shard='shard0'):
8080
gzip_input = StringIO(b64decode(ret['data'][3:]))
8181
except:
8282
gzip_input = BytesIO(b64decode(ret['data'][3:]))
83-
ret['data'] = json.load(GzipFile(fileobj=gzip_input))
83+
gzip_string = GzipFile(fileobj=gzip_input).read().decode("utf-8")
84+
ret['data'] = json.loads(gzip_string)
8485
return ret
8586

8687
def set_memory(self, path, value, shard='shard0'):
@@ -93,7 +94,8 @@ def get_segment(self, segment, shard='shard0'):
9394
gzip_input = StringIO(b64decode(ret['data'][3:]))
9495
except:
9596
gzip_input = BytesIO(b64decode(ret['data'][3:]))
96-
ret['data'] = GzipFile(fileobj=gzip_input)
97+
gzip_string = GzipFile(fileobj=gzip_input).read().decode("utf-8")
98+
ret['data'] = json.loads(gzip_string)
9799
return ret
98100

99101

0 commit comments

Comments
 (0)