How do I serve an image from a python script?
haaserd at yahoo.com
Thu Jun 7 22:35:07 EDT 2001
I am trying to serve an image from a Python script using Apache under
Windows. My simple HTML statement:
<img src="ShowPict.py?fn=xxx" alt="a picture">
...and my simple script:
n = 'c:/My Pictures/Sample.jpg'
p = open(n,'rb')
apix = p.read()
if __name__ == '__main__':
As you can see I am ignoring the CGI fields for the moment and am just trying
to serve up an image. Through debugging statements that I have removed, I
know the program crashes on the statement
if the picture is over 200,000 bytes.
On small images (10k), the script runs to completion, but no image appears.
What am I doing wrong?
More information about the Python-list