浏览代码

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 年前
父节点
当前提交
1dd89a2322
共有 1 个文件被更改,包括 2 次插入2 次删除
  1. 2
    2
      gitstats

+ 2
- 2
gitstats 查看文件

@@ -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)