From f3b7ee2d3e1bfe77d690245bc3311b65faf0126b Mon Sep 17 00:00:00 2001 From: Andrew Murray Date: Tue, 15 Mar 2022 08:31:17 +1100 Subject: [PATCH] Do not pass None to subprocess --- src/PIL/ImageShow.py | 10 ++++++---- 1 file changed, 6 insertions(+), 4 deletions(-) diff --git a/src/PIL/ImageShow.py b/src/PIL/ImageShow.py index 6109f0bcfac..395bb225873 100644 --- a/src/PIL/ImageShow.py +++ b/src/PIL/ImageShow.py @@ -270,8 +270,9 @@ def show_file(self, path=None, **options): else: raise TypeError("Missing required argument: 'path'") args = ["display"] - if "title" in options: - args += ["-title", options["title"]] + title = options.get("title") + if title: + args += ["-title", title] args.append(path) subprocess.Popen(args) @@ -368,8 +369,9 @@ def show_file(self, path=None, **options): else: raise TypeError("Missing required argument: 'path'") args = ["xv"] - if "title" in options: - args += ["-name", options["title"]] + title = options.get("title") + if title: + args += ["-name", title] args.append(path) subprocess.Popen(args)