Bladeren bron

Open the cache in binary mode.

This fixes an issue where the cache fails to load on Windows machines.
EOL characters were getting modified, causing zlib uncompression to fail.

[hoxu@users.sf.net: slightly modified the commit message]

Signed-off-by: Heikki Hokkanen <hoxu@users.sf.net>
Tyler Nielsen 15 jaren geleden
bovenliggende
commit
1dd89a2322
1 gewijzigde bestanden met toevoegingen van 2 en 2 verwijderingen
  1. 2
    2
      gitstats

+ 2
- 2
gitstats Bestand weergeven

@@ -87,7 +87,7 @@ class DataCollector:
87 87
 		if not os.path.exists(cachefile):
88 88
 			return
89 89
 		print 'Loading cache...'
90
-		f = open(cachefile)
90
+		f = open(cachefile, 'rb')
91 91
 		try:
92 92
 			self.cache = pickle.loads(zlib.decompress(f.read()))
93 93
 		except:
@@ -149,7 +149,7 @@ class DataCollector:
149 149
 	# Save cacheable data
150 150
 	def saveCache(self, cachefile):
151 151
 		print 'Saving cache...'
152
-		f = open(cachefile, 'w')
152
+		f = open(cachefile, 'wb')
153 153
 		#pickle.dump(self.cache, f)
154 154
 		data = zlib.compress(pickle.dumps(self.cache))
155 155
 		f.write(data)