Skip to content

Commit

Permalink
Merge pull request #3518 from radarhere/imageshow
Browse files Browse the repository at this point in the history
im.show: Fix writing to temporary file
  • Loading branch information
hugovk committed Dec 31, 2018
2 parents 37d61f1 + bc3925e commit b9d102e
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/PIL/ImageShow.py
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@ def get_command(self, file, **options):

def show_file(self, file, **options):
"""Display given file"""
f, path = tempfile.mkstemp()
f.write(file)
f.close()
fd, path = tempfile.mkstemp()
with os.fdopen(fd, 'w') as f:
f.write(file)
with open(path, "r") as f:
subprocess.Popen([
'im=$(cat);'
Expand Down Expand Up @@ -171,9 +171,9 @@ def get_command(self, file, **options):

def show_file(self, file, **options):
"""Display given file"""
f, path = tempfile.mkstemp()
f.write(file)
f.close()
fd, path = tempfile.mkstemp()
with os.fdopen(fd, 'w') as f:
f.write(file)
with open(path, "r") as f:
command = self.get_command_ex(file, **options)[0]
subprocess.Popen([
Expand Down

0 comments on commit b9d102e

Please sign in to comment.