Do not call sys.executable in ImageShow in PyInstaller application (#9028)

This commit is contained in:
Hugo van Kemenade 2025-06-25 10:46:46 +01:00 committed by GitHub
commit 8cf8b0dde0
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194

View File

@ -175,7 +175,9 @@ class MacViewer(Viewer):
if not os.path.exists(path):
raise FileNotFoundError
subprocess.call(["open", "-a", "Preview.app", path])
executable = sys.executable or shutil.which("python3")
pyinstaller = getattr(sys, "frozen", False) and hasattr(sys, "_MEIPASS")
executable = (not pyinstaller and sys.executable) or shutil.which("python3")
if executable:
subprocess.Popen(
[