files are opened in binary for windows compatibility
This commit is contained in:
4
nbt.py
4
nbt.py
@@ -4,12 +4,12 @@ import struct
|
|||||||
def load(fileobj):
|
def load(fileobj):
|
||||||
if isinstance(fileobj, basestring):
|
if isinstance(fileobj, basestring):
|
||||||
# Is actually a filename
|
# Is actually a filename
|
||||||
fileobj = open(fileobj, 'r')
|
fileobj = open(fileobj, 'rb')
|
||||||
return NBTFileReader(fileobj).read_all()
|
return NBTFileReader(fileobj).read_all()
|
||||||
|
|
||||||
class NBTFileReader(object):
|
class NBTFileReader(object):
|
||||||
def __init__(self, fileobj):
|
def __init__(self, fileobj):
|
||||||
self._file = gzip.GzipFile(fileobj=fileobj, mode='r')
|
self._file = gzip.GzipFile(fileobj=fileobj, mode='rb')
|
||||||
|
|
||||||
# These private methods read the payload only of the following types
|
# These private methods read the payload only of the following types
|
||||||
def _read_tag_end(self):
|
def _read_tag_end(self):
|
||||||
|
|||||||
Reference in New Issue
Block a user