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)