From 525eaf738973615150349fa3c690e4c168bd4bc3 Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Sun, 3 Mar 2019 13:02:00 +1100 Subject: [PATCH] Renamed file variable --- Tests/test_file_msp.py | 6 +++--- src/PIL/GifImagePlugin.py | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/Tests/test_file_msp.py b/Tests/test_file_msp.py index 66af65fcd..724fc78b1 100644 --- a/Tests/test_file_msp.py +++ b/Tests/test_file_msp.py @@ -12,11 +12,11 @@ YA_EXTRA_DIR = "Tests/images/msp" 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)) diff --git a/src/PIL/GifImagePlugin.py b/src/PIL/GifImagePlugin.py index 2d13de022..2ebd8b248 100644 --- a/src/PIL/GifImagePlugin.py +++ b/src/PIL/GifImagePlugin.py @@ -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) @@ -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