Read the data as a binary
authorebadawy <ehalbadawy93@gmail.com>
Sun, 24 Apr 2016 18:24:41 +0000 (20:24 +0200)
committerebadawy <ehalbadawy93@gmail.com>
Sun, 24 Apr 2016 18:25:45 +0000 (20:25 +0200)
Appending 'b' in the file mode as hashlib functions require to pass in bytes

scripts/download_model_binary.py

index 66f72f2..fcdbb5a 100755 (executable)
@@ -60,7 +60,7 @@ if __name__ == '__main__':
 
     # Closure-d function for checking SHA1.
     def model_checks_out(filename=model_filename, sha1=frontmatter['sha1']):
-        with open(filename, 'r') as f:
+        with open(filename, 'rb') as f:
             return hashlib.sha1(f.read()).hexdigest() == sha1
 
     # Check if model exists.