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

noreply@sourceforge.net noreply@sourceforge.net
Sat, 27 Oct 2001 06:43:09 -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: Open
Resolution: None
Priority: 5
Submitted By: M. Ibaraki (redmaple)
Assigned to: Nobody/Anonymous (nobody)
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 

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

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