Re: [HELP!] a doubt about entering password in python

2013-01-17 Thread Chris Angelico
On Fri, Jan 18, 2013 at 3:45 PM, Ramchandra Apte wrote: > I think you are correct - su uses some tty magic to stop ECHO and probably > doesn't read the password from stdin. I believe that's right, but the 'sudo' command - at least on my Debian and Ubuntu systems - accepts a -S parameter to read

Re: [HELP!] a doubt about entering password in python

2013-01-17 Thread Ramchandra Apte
On Friday, January 18, 2013 9:30:29 AM UTC+5:30, MRAB wrote: > On 2013-01-18 03:12, Steven D'Aprano wrote: > > > On Fri, 18 Jan 2013 10:49:30 +0800, douxin wrote: > > > > > >> i use Popen to execute "su -c 'fdisk -l'" in sub process,and > > >> assigned subprocess.PIPE to stdin,stdout i

Re: [HELP!] a doubt about entering password in python

2013-01-17 Thread MRAB
On 2013-01-18 03:12, Steven D'Aprano wrote: On Fri, 18 Jan 2013 10:49:30 +0800, douxin wrote: i use Popen to execute "su -c 'fdisk -l'" in sub process,and assigned subprocess.PIPE to stdin,stdout i tried to enter password by doing "stdin.write("password"+"\n")" and i expected i coul

Re: [HELP!] a doubt about entering password in python

2013-01-17 Thread Steven D'Aprano
On Fri, 18 Jan 2013 10:49:30 +0800, douxin wrote: > i use Popen to execute "su -c 'fdisk -l'" in sub process,and > assigned subprocess.PIPE to stdin,stdout i tried to enter password > by doing "stdin.write("password"+"\n")" and i expected i could get > the output of "fdisk -l" by d

[HELP!] a doubt about entering password in python

2013-01-17 Thread douxin
Hi all: i have some doubts in doing python programming i wanted to execute a command "su -c 'fdisk -l'",and it needed a password so i wanted to write a python script to get this done. i knew 'pexpect' would work fine,but i had to set a certain timeout to take care of the real