How to debug CGI scripts with simulated variables from server?

S

Sean Berry

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
 
W

William Park

Sean Berry said:
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.

Works fine here (Slackware-9.1 Linux, bash-2.05b). Try
export QUERY_STRING=...
./aqua_getShapes
 
D

David M. Cooke

Sean Berry said:
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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,766
Messages
2,569,569
Members
45,042
Latest member
icassiem

Latest Threads

Top