Skip to content

Commit

Permalink
Merge pull request #6416 from bryant1410/patch-1
Browse files Browse the repository at this point in the history
Fix when `sys.executable` is empty or null
  • Loading branch information
hugovk committed Jul 6, 2022
2 parents 9ac5a70 + 4f7f547 commit 14b457e
Showing 1 changed file with 10 additions and 8 deletions.
18 changes: 10 additions & 8 deletions src/PIL/ImageShow.py
Expand Up @@ -178,14 +178,16 @@ def show_file(self, path=None, **options):
else:
raise TypeError("Missing required argument: 'path'")
subprocess.call(["open", "-a", "Preview.app", path])
subprocess.Popen(
[
sys.executable,
"-c",
"import os, sys, time; time.sleep(20); os.remove(sys.argv[1])",
path,
]
)
executable = sys.executable or shutil.which("python3")
if executable:
subprocess.Popen(
[
executable,
"-c",
"import os, sys, time; time.sleep(20); os.remove(sys.argv[1])",
path,
]
)
return 1


Expand Down

0 comments on commit 14b457e

Please sign in to comment.