I've been developing some CGI based scripts in Pythonista and had intended to use the CGIHTTPServer module to test them, but when I tried to import the module I got an error saying the module did not exist. I assume this is due to Apple's restrictions on executing code within apps but I wanted to check to see if it could possibly be added in a later version before I go out and try to set up a web server to test my scripts.
You could always install the module yourself.
This is pure python, for example found here:
The problems I see:
- I don't think pythonista can do fork, popen, etc. That basically means you are limited to using python scripts.
- The fallback mentioned when fork, etc are not available is to execute within the script... but this is a lie. It calls subprocess, which we also don't have. So you probably need to modify the logic for
if self.is_python(scriptfile):, to use something like
execfile. I think you'd have to modify the stdin/stdout to get access to them.
If you are trying to use something like shell script, you may be out of luck, although stash supports a very primitave style of shell script. Again, you'd have to modify the script launching bit to have stash launch the script.
Actually, an older version of CGIHTTPServer might work better, since it actually does use execfile as mentioned in the comments.
The 2.6 version works for my purposes by changing the
Falsesince Pythonista seems to think
oshas all of those methods but they all raise errors.