file modes

Paul Robinson paul.robinson at quantisci.co.uk
Tue Feb 1 13:04:12 EST 2000


Dave Berkeley wrote:
> 
> Hi All
> 
> I'm trying to write a CGI script that returns image data instead of HTML.
> The problem is that sys.stdout is opened in text mode, and I need to write
> in binary.

I've got two options to try:
1) is the data being read from a file and is this definately being
opened in binary mode
2) is the server (and/or browser) setup to recognise that
application/octet-stream is a binary format

Hope this helps...

        Paul

-----------------------------------
Business Collaborator Team
Enviros Software Solutions
http://www.businesscollaborator.com
-----------------------------------




More information about the Python-list mailing list