Always read binary files with mode rb
This commit is contained in:
+1
-1
@@ -114,7 +114,7 @@ def main(argv):
|
|||||||
output = open(options.output, 'w')
|
output = open(options.output, 'w')
|
||||||
else:
|
else:
|
||||||
output = sys.stdout
|
output = sys.stdout
|
||||||
output.write(pystache.render(open(options.template).read(), context))
|
output.write(pystache.render(open(options.template, 'rb').read(), context))
|
||||||
|
|
||||||
|
|
||||||
if __name__ == '__main__':
|
if __name__ == '__main__':
|
||||||
|
|||||||
@@ -153,7 +153,7 @@ PROJ4JS_ZIP_MD5 = '17caad64cf6ebc6e6fe62f292b134897'
|
|||||||
def report_sizes(t):
|
def report_sizes(t):
|
||||||
stringio = StringIO()
|
stringio = StringIO()
|
||||||
gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio)
|
gzipfile = gzip.GzipFile(t.name, 'w', 9, stringio)
|
||||||
with open(t.name) as f:
|
with open(t.name, 'rb') as f:
|
||||||
shutil.copyfileobj(f, gzipfile)
|
shutil.copyfileobj(f, gzipfile)
|
||||||
gzipfile.close()
|
gzipfile.close()
|
||||||
rawsize = os.stat(t.name).st_size
|
rawsize = os.stat(t.name).st_size
|
||||||
|
|||||||
Reference in New Issue
Block a user