I don't have any experience with python, but I've been doing a lot of work with perl cgi programs on Gumstix.

The Bad Gateway error usually means that python or your script is spitting out an error message that doesn't look like a valid http response.

The first place to look:   file permissions.  Your script will execute as  www-data when run from boa and as root when run from the shell.  Make sure that the script has the appropriate read, write, and execute permissions for all of the data files and modules that it uses.

If the permissions check out, then you should look for differences in the environment variables when your script is run from boa vs the shell.

You can use a simple shell cgi to see what your script is getting from boa:

echo -e 'HTTP/1.1 200 OK\r\nContent-type: text/plain\r\n\r\n'

Compare this to what you get from the env command when executed from the shell.

Good luck!  I know that this type of problem can be really frustrating to debug.


On 2/1/07, Mark Heneghan <> wrote:
Hi all,
Im having problems running python cgi. programs work fine if all your doing is outputting text or a few calculations, but it seems to be unable to import any modules and gives error 502 in my browser; Bad Gateway. Does any one have any idea as to why im unable to import modules such as pxaregs, cgi or string, which can all be imported fine if running in a normal program?
Thanks and Regards,
Mark Heneghan

Using Tomcat but need to do more? Need to support web services, security?
Get stuff done quickly with pre-integrated technology to make your job easier.
Download IBM WebSphere Application Server v.1.0.1 based on Apache Geronimo

gumstix-users mailing list