Firefox: all I get is XML page source code

Gnarlodious gnarlodious at gmail.com
Sun Apr 18 16:50:20 EDT 2010


Wit's end on this. I have a script outputting a stream with:
sys.stdout.buffer.write(("""\n<?xml version='1.0' encoding='utf-8'?>

The script works normally in 2 browsers, but in Firefox all I see is
source code.

Also, running the script in iPhone from my server shows the same
source code. Which is a little strange since iPhone and Safari both
use Webkit. This occurs also on my home dev server.

I attempted to validate the output but all I get is error:


 Sorry, I am unable to validate this document because its content type
is text/plain, which is not currently supported by this service.
The Content-Type header is sent by your web server (or web browser if
you use the file upload interface) and depends on its configuration.
Commonly, web servers will have a mapping of filename extensions (such
as ".html") to MIME Content-Type values (such as text/html).
That you received this message can mean that your server is not
configured correctly, that your file does not have the correct
filename extension, or that you are attempting to validate a file type
that we do not support yet.


Is the output stream not recognized because of the
sys.stdout.buffer.write statement?

This is a Python3 script ending with .py. Server is Apache 2.  Hope
someone can explain.

-- Gnarlie



More information about the Python-list mailing list