I'm trying to return a png image to browser using python cgi on IIS.
I got the same problem with this: Return an image to the browser in python, cgi-bin
but the solutions provided there don't work on my machine.
Here is a brief intro to my situation:
I have a png image on C:\logs\demo.png, this image is absolutely fine and can be opened by a visual image viewer;
I have a python script with the code below:
print 'HTTP/1.1 200 OK' print 'Content-Type:image/png\n' print file('c:\\logs\\demo.png', 'rb').read()
3 . when I visit the corresponding url, nothing returned, and firefox says the image contains errors. The length returned in the response is also very small.
Is there any idea about the problem? I'm getting crazy~
Any reply is appreciated:)