6

I would like to show an image using python on windows10 . When I do:

from PIL import Image
im = Image.open('image.png')
im.show()

my default viewer doesn't open up and a error tells me that permmission denied.

I found a workaround here. They recommend changing PIL's code to 

start /wait %s && PING 127.0.0.1 -n 5 > NUL && del /f %s" % (file, file)

However, doesn't work.

I thought, maybe the C:/Windows/Temp denied, so I add a everyone user , but still the same error.

Is there a solution?

clemens
  • 16,716
  • 11
  • 50
  • 65
ELLEN
  • 65
  • 5
  • works for me, but it shows a BMP copy in the temp directory. Can you check your `%TEMP%` environment variable? (`print(os.getenv("TEMP")`). Also paste the following to see if it's not a `mkstemp` problem: `import tempfile z=tempfile.mkstemp("XXX") print (z)` – Jean-François Fabre Sep 24 '16 at 09:44
  • 1
    Check out this answer for the detailed explanation on why it will not work: http://stackoverflow.com/a/24544888/4420129 – isopach Dec 14 '16 at 18:49

1 Answers1

0

go check your default app for .bmp file, just download one and try to open it. if it doesnot opens then you need to change your default app for .bmp file from settings. and even try reinstalling PIL.

Jainil Patel
  • 1,284
  • 7
  • 16