From dbf3d993ed72c0693c7912cff9896b81f9c3ef5d Mon Sep 17 00:00:00 2001 From: Christoph Gohlke Date: Wed, 13 Feb 2013 18:23:30 -0800 Subject: [PATCH] BUG: Windows image viewer unable to open image The issue was reported several times during the past years. The temporary bitmap file is deleted before the image viewer is started. The workaround is to wait some time before deleting the file. http://stackoverflow.com/questions/4607633/image-format-to-save-in-python http://stackoverflow.com/questions/7715501/pil-image-show-doesnt-work-on-windows-7 --- PIL/ImageShow.py | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/PIL/ImageShow.py b/PIL/ImageShow.py index a5275def4..fdb9816f7 100644 --- a/PIL/ImageShow.py +++ b/PIL/ImageShow.py @@ -98,7 +98,8 @@ if sys.platform == "win32": class WindowsViewer(Viewer): format = "BMP" def get_command(self, file, **options): - return "start /wait %s && del /f %s" % (file, file) + return ("start /wait %s && ping -n 2 127.0.0.1 >NUL " + "&& del /f %s" % (file, file)) register(WindowsViewer)