Only cover the actual IO with the IOError

https://github.com/Textualize/textual/pull/1116#discussion_r1014606445
This commit is contained in:
Dave Pearson
2022-11-05 09:57:31 +00:00
parent 83de33f537
commit 76360204b5

View File

@@ -28,9 +28,9 @@ def shebang_python(candidate: Path) -> bool:
try:
with candidate.open("rb") as source:
first_line = source.readline()
return first_line.startswith(b"#!") and b"python" in first_line
except IOError:
return False
return first_line.startswith(b"#!") and b"python" in first_line
def import_app(import_name: str) -> App: