Skip to content

Commit 8cf8b0d

Browse files
authored
Do not call sys.executable in ImageShow in PyInstaller application (#9028)
2 parents c704f43 + f937dd2 commit 8cf8b0d

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

src/PIL/ImageShow.py

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -175,7 +175,9 @@ def show_file(self, path: str, **options: Any) -> int:
175175
if not os.path.exists(path):
176176
raise FileNotFoundError
177177
subprocess.call(["open", "-a", "Preview.app", path])
178-
executable = sys.executable or shutil.which("python3")
178+
179+
pyinstaller = getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS")
180+
executable = (not pyinstaller and sys.executable) or shutil.which("python3")
179181
if executable:
180182
subprocess.Popen(
181183
[

0 commit comments

Comments
 (0)