0

files are opened in binary for windows compatibility

This commit is contained in:
Andrew Brown
2010-08-28 19:02:37 -04:00
parent 403815a7dd
commit 145d271195

4
nbt.py
View File

@@ -4,12 +4,12 @@ import struct
def load(fileobj):
if isinstance(fileobj, basestring):
# Is actually a filename
fileobj = open(fileobj, 'r')
fileobj = open(fileobj, 'rb')
return NBTFileReader(fileobj).read_all()
class NBTFileReader(object):
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
def _read_tag_end(self):