httpd-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Simon Hook <simon.j.h...@jpl.nasa.gov>
Subject Re: [users@httpd] Apache 2.0.53 will not display png from 4 line python script
Date Sat, 19 Mar 2005 18:14:34 GMT
Andre,

Your solution does not work. If you have something you have tested and 
works, please send.

thanks,

Simon

André Malo wrote:

>* Simon Hook wrote:
>
>  
>
>>I have a 4 line python script which should display a png that is in the
>>same directory as the script. The script is:
>>
>>#!d:/apps/Python23/python.exe
>>
>>fp = open('tmp.png','rb')
>>print "Content-type: image/png\n"
>>print fp.read()
>>fp.close()
>>
>>Any ideas would be much appreciated.
>>    
>>
>
>(1) Missing an empty line between the headers and the body
>(2) Never use print with binary data
>(3) Use binary mode on stdout on Win32 systems when working with binary data
>
>#!d:/apps/Python23/python.exe
>
>import os, sys, msvcrt
>
>fp = open('tmp.png', 'rb')
>print "Content-type: image/png\n\n"
>msvcrt.setmode(sys.stdout.fileno(), os.O_BINARY)
>sys.stdout.write(fp.read())
>fp.close()
>
>(untested)
>
>nd
>  
>

-- 

+++++++++++++++++++++++++++++++++++++++++
Simon J. Hook, MSc, PhD
Jet Propulsion Laboratory  
MS 183-501
Pasadena, CA 91109
Office: 818-354-0974
Fax: 818-354-0966
Email: simon.j.hook@jpl.nasa.gov
http://asterweb.jpl.nasa.gov
http://masterweb.jpl.nasa.gov
http://laketahoe.jpl.nasa.gov
+++++++++++++++++++++++++++++++++++++++++ 


---------------------------------------------------------------------
The official User-To-User support forum of the Apache HTTP Server Project.
See <URL:http://httpd.apache.org/userslist.html> for more info.
To unsubscribe, e-mail: users-unsubscribe@httpd.apache.org
   "   from the digest: users-digest-unsubscribe@httpd.apache.org
For additional commands, e-mail: users-help@httpd.apache.org


Mime
View raw message