Commit 341dcb8a authored by Lisandro Dalcin's avatar Lisandro Dalcin

fix error when Lexicon source file cannot be open (Cython inside a ZIP file)

parent 091ba984
...@@ -48,6 +48,7 @@ def hash_source_file(path): ...@@ -48,6 +48,7 @@ def hash_source_file(path):
from hashlib import md5 as new_md5 from hashlib import md5 as new_md5
except ImportError: except ImportError:
from md5 import new as new_md5 from md5 import new as new_md5
f = None
try: try:
try: try:
f = open(path, "rU") f = open(path, "rU")
...@@ -56,7 +57,8 @@ def hash_source_file(path): ...@@ -56,7 +57,8 @@ def hash_source_file(path):
print("Unable to hash scanner source file (%s)" % e) print("Unable to hash scanner source file (%s)" % e)
return "" return ""
finally: finally:
f.close() if f:
f.close()
# Normalise spaces/tabs. We don't know what sort of # Normalise spaces/tabs. We don't know what sort of
# space-tab substitution the file may have been # space-tab substitution the file may have been
# through, so we replace all spans of spaces and # through, so we replace all spans of spaces and
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment