"Joerg Baumann" <joerg.baumann at stud.informatik.uni-erlangen.de> wrote in
message news:39DCCC70.71056C01 at stud.informatik.uni-erlangen.de...
There is the CGIHTTPRequestHandler defined in the standard library.
It does not meet Tobe's request, which was:
I'm trying to find a way to spawn, wait for and read stdout of child
processes that works on both win32 and *nix machines...
The library module you mention is Unix-only: it relies on fork/exec
to run the child process for CGI.
It's not clear to me how a parent process can (under *nix) retrieve the
output of a forked child...
It opens a pipe, sets the write-end as the child's stdout (then later
closes it in the fork-parent's side), keeps and uses the read-end in
the fork-parent (and closes it in the fork-child before the exec).
I can't get spawnv to work on win32. It always fails with 'OSError:
8] Exec format error' (and even if I did how do I retrieve it's stdout
I think some variation of popen is what you may be looking for. sys.popen
should be fixed in recent versions (not sure about 1.6), but you can use
the win32api module's version if you must ensure running with older
Python releases (1.5.2).
This is all for a minimal CGI capable HTTP server that I can use to test
scripts accross both platforms...
Sorry, I don't know of a ready-made one. It would be very nice to
have a version of CGIHTTPRequestHandler modified to use popen
and thus be cross-platform rather than Unix-only...