[PythonCE] PythonCE, Apache and CGI?

Will Hawes wdhawes at gmail.com
Tue Aug 4 14:00:05 CEST 2009

I've got perl CGI scripts running on Apache on a Windows Mobile 6
device using http://www.rainer-keuchel.de/wince/apache-ce.html and
http://perlce.sourceforge.net/. I'm trying to get Python working in
the same way, which seems as though it might be possible, but have hit
a problem.

With the device connected via ActiveSync, I tried accessing the
following python script via "":


print "Content-type: text/html\n\n"

This resulted in the PythonCE shell popping up on the device, where it
appeared to generate the correct output, but the output was not sent
to the browser.

I read about the "/nopcceshell" switch on the PythonCE wiki so tried
this instead:

#!/python25/python.exe /nopcceshell

print "Content-type: text/html\n\n"

The web browser still hangs, but the PythonCE shell no longer appears
on the device. Instead I see the following error on the device:

Traceback (innermost last):
 File "\apache\cgi-bin\test.py", line 3, in <module>
   print "Content-type: text/html\n\n"
<type 'exceptions.IOError'>: [Errno 2] The system cannot find the file specified

Evidently Python is finding and trying to execute test.py - my guess
is that this error relates to either STDOUT or STDERR. Can anyone shed
any light on this, or better still provide a workaround?

Thanks, Will

More information about the PythonCE mailing list