[Python-bugs-list] [ python-Bugs-475538 ] os.system() and cgi

noreply@sourceforge.net noreply@sourceforge.net
Sat, 27 Oct 2001 08:53:15 -0700


Bugs item #475538, was opened at 2001-10-27 06:43
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=475538&group_id=5470

Category: Extension Modules
Group: Python 2.1.1
>Status: Closed
Resolution: None
Priority: 5
Submitted By: M. Ibaraki (redmaple)
>Assigned to: Guido van Rossum (gvanrossum)
Summary: os.system() and cgi

Initial Comment:
This script (test.py) works fine and creates a file
'outputfile' when I run this in test mode (python
test.py).
 
 
--- test.py ----
#!/usr/bin/python
 
import cgi, os
 
print "Content-type: text/html\r\n"
print "<html>"
print "<body bgcolor=white>"
 
ret =  os.system('/usr/X11R6/bin/xmgrace -help >
outputfile')
# ret =  os.system('/bin/ls > outputfile')
 
print "<p> ret = ", ret
----------------
 
 
 
It shows:
 
Content-type: text/html
 
<html>
<body bgcolor=white>
<p> ret =  0
 
 
 
However, when this is executed as a cgi it shows:
 
ret = 256
 
and no 'outputfile' file is created.
 
 
 
Permission of /usr/X11R6/bin/xmgrace is:
-rwxr-xr-x    1 root     root          450 May 20 18:48
/usr/X11R6/bin/xmgrace
 
xmgrace is a 2D plotting tool
(http://plasma-gate.weizmann.ac.il/Grace/)
 
 
 
I also tried '/bin/ls > outputfile' instead of
'/usr/X11R6/bin/xmgrace -help > outputfile'. This 'ls'
command is executed and it creates 'outputfile' in both
cgi and test modes.
 
 
Permission of /bin/ls is:
-rwxr-xr-x    1 root     root        48316 Sep 15 12:54
/bin/ls
 
 
Any comments would be greatly appreciated.
 
 
M. Ibaraki 

----------------------------------------------------------------------

>Comment By: Guido van Rossum (gvanrossum)
Date: 2001-10-27 08:53

Message:
Logged In: YES 
user_id=6380

I can't help you with this. This really doesn't look like a
Python bug; more some kind of configuration problem. Try
posting on comp.lang.python.

If you hadn't said that outputfile is not created, I
would've guessed that xmgrace, being an X11 tool, doesn't
like not having a DISPLAY environment variable. But then it
would still have created an (empty) outputfile.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=475538&group_id=5470