Inets, CGI, Python, and Windows, oh my!
Wed Feb 21 21:54:20 CET 2001
This may help:
HOWTO: Use a CMD or BAT File as a CGI Script
Internet Information Server 1.0 (IIS) can use .cmd or
.bat files as CGI scripts. In IIS 2.0 and 3.0, this
capability has been removed by default.
You can enable the use of .cmd and .bat files with IIS
by adding a script mapping to the registry.
WARNING: Using Registry Editor incorrectly can cause
serious problems that may require you to reinstall
Windows. Microsoft cannot guarantee that problems
resulting from the incorrect use of Registry Editor
can be solved. Use Registry Editor at your own risk.
For information about how to edit the registry, view
the "Changing Keys And Values" online Help topic in
Registry Editor (Regedit.exe) or the "Add and Delete
Information in the Registry" and "Edit Registry Data"
online Help topics in Regedt32.exe. Note that you
should back up the registry before you edit it.
Start Registry Editor (Regedt32.exe) and locate the
following registry subkey in the HKEY_LOCAL_MACHINE
On the Edit menu, click Add Value.
Enter the following for .cmd files:
Value Name: .CMD
Data Type: REG_SZ
"\Winnt\system32\cmd.exe /c %s %s" (Leave off the
For .BAT files, repeat this process and substitute
.BAT for .CMD in the value name.
Use any text editor to create the following script and
save it as myscript.cmd.
echo Content-Type: text/plain
echo Hello World!!
The above test script can be placed in the IIS server
\scripts directory. You can run this script from the
following URL, for example:
--- Bijan Parsia <bparsia@REDACTED> wrote:
> Or "Oh damn!" ;)
> Anyone have any tips on running python cgi scripts
> under Inets under
> Windows (gag) 98?
> AFAICT, it's not going to work out of the box no
> matter how I diddle the
> settings. mod_cgi:is_executable/1 seems incapable of
> recognizing *.py
> files as executables because, well, they *aren't* to
> Windows, or rather,
> to *dos* (yuck!).
> (Note that os:find_executable(python) works, so the
> python executable is
> in my PATH variable.)
> Even if it would find the interpereter, it's not
> clear that it will get
> any results or even execute the script.
> os:cmd("python tester.py").
> doesn't work. It doesn't execute the script (though
> sometimes it *does*
> crash windows).
> os:cmd("python -c \"import tester; tester.test()").
> *does* work and even gets the results.
> Oh the pain.
> Any hints like suffering souls care to share?
> Bijan Parsia.
Do You Yahoo!?
Yahoo! Auctions - Buy the things you want at great prices! http://auctions.yahoo.com/
More information about the erlang-questions