We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
1 parent f9c7c6c commit 834cd27Copy full SHA for 834cd27
1 file changed
pytype/file_utils.py
@@ -148,6 +148,9 @@ def is_file_script(filename, directory=None):
148
# of course we assume that they start with a shebang
149
file_path = expand_path(filename, directory)
150
if path_utils.isfile(file_path):
151
- with open(file_path, "r") as file:
152
- line = file.readline().rstrip().lower()
+ with open(file_path, "r") as fi:
+ try:
153
+ line = fi.readline().rstrip().lower()
154
+ except UnicodeDecodeError:
155
+ return False
156
return re.fullmatch(r"#!.+python3?", line) is not None
0 commit comments