Local Python Server Installation

Steve Holden sholden at holdenweb.com
Fri Sep 27 23:16:01 CEST 2002


"Kenneth Gomez" <kennethg at pd.jaring.my> wrote ...
> Steve,
>
> I stumbled onto this problem while going through the first exmaple in
> the book Python:How to Progra, by Deitel, Deitel, Liperi and
> Wiedermann.
>
> My little code sniipet, copied exactly from the book except for the
> path to my python exe is :
>
> ________________________________________________
>
> #!C:\prog\Python22\python.exe
>
> import time
>
> def printheader(title):
> print """Content-type: text/html
>
> <?xml version = "1.0" encoding = "UTF-8"?>
> <!DOCTYPE html PUBLIC
> "-//W3C//DTD XHTML 1.0 Strict//EN"
> "DTD/xhtml1-strict.dtd">
> <html xmlns = "http://www.w3.org/1999/xhtml">
> <head><title>%s</title></head>
>
> <body>""" % title
>
> printheader("Current Date & Time")
> print time.ctime(time.time())
> print "</body></html>"
> ___________________________________________________
>
This looks OK given the mailer mangling that's (presumably) lost some tabs
from the code.

>
> I get the following error in IE6 :
>
> The XML page cannot be displayed
> Cannot view XML input using style sheet. Please correct the error and
> then click the Refresh button, or try again later.
>
Interesting that it even recognises XML given the Content-Type header and
the fact that the program doesn't seem to be running.
>
> --------------------------------------------------------------------------
------
>
> Invalid at the top level of the document. Error processing resource
> 'http://localhost/ken.py'. Line 1, Position 1
>
> #!C:\prog\Python22\python.exe
> ^
>
So, basically, IE6 is also seeing a listing of the script. This isn't
surprising: the server behavior is unlikely to change with a change of
client.
>
> and when using Mozilla 1.0, all I get is the listing of the script.
>
> Bummer.
>
> Any advise?
>
Don't know. I presume you have already made

    http://httpd.apache.org/docs-2.0/platform/windows.html

your bible? It does tell you almost all of what you need to know.

regards
-----------------------------------------------------------------------
Steve Holden                                  http://www.holdenweb.com/
Python Web Programming                 http://pydish.holdenweb.com/pwp/
Previous .sig file retired to                    www.homeforoldsigs.com
-----------------------------------------------------------------------






More information about the Python-list mailing list