python cgi + IIS

Steve Holden sholden at holdenweb.com
Tue Jun 18 16:50:13 EDT 2002


"Axel Grune" <NineOfSix at gmx.de> wrote in message
news:3D0F1813.3010304 at gmx.de...
> Hi, I'm trying to get my IIS (Win2k Pro) execute my python scripts.
> I added the 'App Mapping' info for '.pycgi' files in the properties of
> IISAdmin (Computermanagement) as I read in the internet. The string
> for the executable file is 'D:\Python22\python.exe -u %s %s' (the path
> is valid).
> But when i try to call it within my browser, it just displays it like a
> normal text file instead of executing it.
>
>
> the script (its called test.pycgi):
> #!/usr/bin/python
>
> print "Content-Type: text/plain\n\n"
> print "Hallo Welt"
>
>
> has anyone an idea?
>
You have almost certainly made a typo, or you didn't apply the changes to
the directory you are trying to run the CGI from. I just followed the steps
at

    http://www.e-coli.net/pyiis.html

to install .cgipy as a Python-executing extension, and everything worked --
the following program printed out a complete list of environment variables.
#
# Python CGI script
#
import os
print """Content-Type: text/html

<html>
<head>
  <title>Python Web Page</title>
</head>
<body>
"""

for k, v in os.environ.items():
    print "%s=%s<br>\n" % (k, v)

print """
</body>
</html>
"""

Personally I'd rather run CGI than use ASP under IIS, so I hope you can get
it to work. Clearly at the moment IIS isn't recognising the .cgi extension
as needing to run the Python interpreter.

regards
-----------------------------------------------------------------------
Steve Holden                                 http://www.holdenweb.com/
Python Web Programming                http://pydish.holdenweb.com/pwp/
-----------------------------------------------------------------------








More information about the Python-list mailing list