From d08429643dac3eadf57679daf3e450a50cb023d3 Mon Sep 17 00:00:00 2001 From: David Vierra Date: Sat, 18 Sep 2010 01:55:11 -1000 Subject: [PATCH] clarify the temp variable for decompression here --- mclevel.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/mclevel.py b/mclevel.py index 0a2b4ca..4a21a73 100644 --- a/mclevel.py +++ b/mclevel.py @@ -622,14 +622,16 @@ class MCLevel: #ungzdata = None compressed = True + unzippedData = None; try: - data = gzip.GzipFile(fileobj=StringIO.StringIO(rawdata)).read(); + unzippedData = gzip.GzipFile(fileobj=StringIO.StringIO(rawdata)).read(); except Exception,e: print "Exception during Gzip operation, assuming {0} uncompressed: ".format(filename), e - compressed = False; + if unzippedData is None: + compressed = False; #if(ungzdata): data=ungzdata - data = fromstring(data, dtype='uint8') + data = fromstring(unzippedData, dtype='uint8') if isJavaLevel(data): print "Detected compressed Java-style level"