Python & Linux, some questions (2)
Luca T.
lucat at despammed.com
Mon Mar 15 15:28:47 EST 2004
Ok...
Now...
I made this simple program as a test:
import popen2
r,w,e = popen2.popen3('su -c ls')
for line in e.readlines():
print 'E: ' + line
for line in r.readlines():
print 'R: ' + line
r.close
w.close
e.close
In few words, it runs "su -c ls", and it should tell me what it writes
in stdout and stderr.
Now... this is what i get:
[luca at ATH2000 tmp]$ python test.py
E: standard in must be a tty
So it seems that "su" refuses to work if it is run like this.
Now, beside "sudo" that i CANNOT use because i don't want to change the
configuration of the user's comp... any idea about how i could run a
program as root from inside my python program?
Thanx,
Luca
More information about the Python-list
mailing list