Passing environment variable to "subprocess" causes failure

2009-02-03 Thread davidgould
I'm attempting to run subprocess and passing in an environment
variable. When I do this the child process fails with an error. When I
don't pass an environement variable it runs fine.

BTW Running this code under Windows XP with Python 2.6.1

Code A:

p = subprocess.Popen( ['python', '-V'], env={ 'PYTHONPATH': 'C:/
Documents and Settings/David Gould/workspace/DgTools/Common/Trunk/
Source' } )
print p.communicate()[0]
print p.returncode

Output:

None
-1072365564

Code B:

p = subprocess.Popen( ['python', '-V'] )
print p.communicate()[0]
print p.returncode

Output:

Python 2.6.1
0

Any idea why passing an environment variable causes it to fail?
Thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Determining from which web page a cgi script is invoked?

2009-03-10 Thread davidgould
Given a webpage test.html that has a form with a cgi script, how can
you determine inside the cgi script the name of the webpage that
invoked the script?

I have many different html pages that use a common cgi script for form
processing and want to determine the name of the webpage.

Thanks.
--
http://mail.python.org/mailman/listinfo/python-list


Re: Determining from which web page a cgi script is invoked?

2009-03-11 Thread davidgould
On Mar 10, 7:15 pm, cm  wrote:
> [email protected] escribió:
>
> > Given a webpage test.html that has a form with a cgi script, how can
> > you determine inside the cgi script the name of the webpage that
> > invoked the script?
>
> > I have many different html pages that use a common cgi script for form
> > processing and want to determine the name of the webpage.
>
> quick&dirty: Add a hidden form var with the page/form name

Yes, I had considered this. Is there any way to quickly automate the
setting of this var to match the html page that contains it?
--
http://mail.python.org/mailman/listinfo/python-list


Re: Determining from which web page a cgi script is invoked?

2009-03-11 Thread davidgould
On Mar 10, 7:15 pm, cm  wrote:
> [email protected] escribió:
>
> > Given a webpage test.html that has a form with a cgi script, how can
> > you determine inside the cgi script the name of the webpage that
> > invoked the script?
>
> > I have many different html pages that use a common cgi script for form
> > processing and want to determine the name of the webpage.
>
> quick&dirty: Add a hidden form var with the page/form name

Yes, I had considered this. Is there any way to quickly automate the
setting of this var to match the html page that contains it?
--
http://mail.python.org/mailman/listinfo/python-list