Skip to content

Commit

Permalink
Merge pull request #3685 from radarhere/file
Browse files Browse the repository at this point in the history
Renamed file variable
  • Loading branch information
hugovk committed Mar 3, 2019
2 parents 28f695d + 525eaf7 commit 571aca6
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 8 deletions.
6 changes: 3 additions & 3 deletions Tests/test_file_msp.py
Expand Up @@ -12,11 +12,11 @@
class TestFileMsp(PillowTestCase):

def test_sanity(self):
file = self.tempfile("temp.msp")
test_file = self.tempfile("temp.msp")

hopper("1").save(file)
hopper("1").save(test_file)

im = Image.open(file)
im = Image.open(test_file)
im.load()
self.assertEqual(im.mode, "1")
self.assertEqual(im.size, (128, 128))
Expand Down
10 changes: 5 additions & 5 deletions src/PIL/GifImagePlugin.py
Expand Up @@ -604,16 +604,16 @@ def _save_netpbm(im, fp, filename):

import os
from subprocess import Popen, check_call, PIPE, CalledProcessError
file = im._dump()
tempfile = im._dump()

with open(filename, 'wb') as f:
if im.mode != "RGB":
with open(os.devnull, 'wb') as devnull:
check_call(["ppmtogif", file], stdout=f, stderr=devnull)
check_call(["ppmtogif", tempfile], stdout=f, stderr=devnull)
else:
# Pipe ppmquant output into ppmtogif
# "ppmquant 256 %s | ppmtogif > %s" % (file, filename)
quant_cmd = ["ppmquant", "256", file]
# "ppmquant 256 %s | ppmtogif > %s" % (tempfile, filename)
quant_cmd = ["ppmquant", "256", tempfile]
togif_cmd = ["ppmtogif"]
with open(os.devnull, 'wb') as devnull:
quant_proc = Popen(quant_cmd, stdout=PIPE, stderr=devnull)
Expand All @@ -632,7 +632,7 @@ def _save_netpbm(im, fp, filename):
raise CalledProcessError(retcode, togif_cmd)

try:
os.unlink(file)
os.unlink(tempfile)
except OSError:
pass

Expand Down

0 comments on commit 571aca6

Please sign in to comment.