How to debug CGI scripts with simulated variables from server?

David M. Cooke cookedm+news at physics.mcmaster.ca
Mon Apr 26 16:51:26 EDT 2004


At some point, "Sean Berry" <sean_berry at cox.net> wrote:

> I want to debug a script that has a line like the following:
> if len(os.environ["QUERY_STRING"]) > 0:
>
> How do I debug this from the command line.  I tried
> QUERY_STRING='sized=72&shaped=3' ./aqua_getShapes
>
> But that returns:
> QUERY_STRING=sized=72&shaped=3: Command not found.
>
> Please help.  Thanks

Are you using tcsh as your shell? The syntax above works with Bourne
shells (bash, etc.). With tcsh, try

$ env QUERY_STRING='sized=72&shaped=3' ./aqua_getShapes

('env' being the same program that most Python scripts use to find the
interpreter in the #! line: #! /usr/bin/env pytho)

or, set the variable in the environment

$ setenv QUERY_STRING='sized=72&shaped=3'
$ ./aqua_getShapes

-- 
|>|\/|<
/--------------------------------------------------------------------------\
|David M. Cooke
|cookedm(at)physics(dot)mcmaster(dot)ca



More information about the Python-list mailing list