On Wed, 2006-15-03 at 12:04 -0500, Hussein Vastani wrote:
> Hello All,
>
> In my application, I run external programs by running a shell using
> subprocess.Popen and then writing commands to it (like 'ls -la') and reading
> output from it which I then display it on the screen.
> It works fine as long as the external program does not need to run as sudo
> (like tethereal), in which case, I need to provide the password to it (on the
> konsole).
>
> I tried looking at the gksu module. Using the gksu module I can instantiate
> its Context class and then call the sudo_run() method after setting the
> command and the password in the Context instance. That works fine but is not
> the approach I want to take since I want to run commands and read their ouput
> back.
>
> So sticking to my use of Popen to execute commands, and assuming I have a way
> to get the sudo password from the user via a Dialog box, how do I then
> exectue
> my command without it asking me a password on the konsole?
>
> I would not like to modify the /etc/sudoers file. Is there any other
> approach?
>
> Any help is appreciated
> Thanks
>
> Hussein Vastani
>
I don't have time to explain it right now. I also was not the one to
code it.
Check out our project : terminal.py
http://cvs.sourceforge.net/viewcvs.py/porthole/porthole/terminal.py?rev=1.145&view=log
It has functionality for detecting the sudo prompt and passing it the
password thru a dialog. It seems to work quite well. We were waiting
for the gksu python interface to go mainstream (in gnome-python-extras)
before integrating it.
--
Brian <[EMAIL PROTECTED]>
___
pygtk mailing list pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://www.async.com.br/faq/pygtk/