Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
> sinan nalkaya <[EMAIL PROTECTED]> writes: > child.expect(['Password:','Password: ',pexpect.EOF,pexpect.TIMEOUT]) > if i == 0: child.sendline(passwd) > elif i == 1:print 1 > elif i == 2:print 2 > elif i == 3:prin

Re: popen and password entry

2006-06-15 Thread sinan nalkaya
finally following code works, import pexpect, sys cmd = '/usr/bin/rsync config [EMAIL PROTECTED]:/tmp/.' #cmd = 'ssh [EMAIL PROTECTED]' child = pexpect.spawn(cmd) child.logfile = sys.stdout passwd = 'qwe123' i = 0 try: while i == 0: i = child.expect(['Password:','Password:

Re: popen and password entry

2006-06-15 Thread sinan nalkaya
i put while True: before top of line, i=child.expect() . it worked, the file has gone but also it goes into loop with many EOF result, i tried the os.waitpid() function with child.pid but didnt help me. still couldn`t get the problem. thanks for help On Thursday 15 June 2006 12:04, Ganesan Raj

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
> sinan nalkaya <[EMAIL PROTECTED]> writes: > thanks for reply, i add the line you suggested, thats what i get > [EMAIL PROTECTED]:~/tmp/multi_server$ python deneme.py > Password: qwe123 > finished Ah, got it. You didn't wait for the rsync process to complete. Put the body of the "try:" in a

Re: popen and password entry

2006-06-15 Thread sinan nalkaya
thanks for reply, i add the line you suggested, thats what i get [EMAIL PROTECTED]:~/tmp/multi_server$ python deneme.py Password: qwe123 finished Exception pexpect.ExceptionPexpect: in > ignored does rsync may cause a problem while trying to fork-exec ssh ? > Add "child.logfile = sys.stdout" he

Re: popen and password entry

2006-06-15 Thread Ganesan Rajagopal
> Sinan Nalkaya <[EMAIL PROTECTED]> writes: > hi, > i have found expect method for this purpose. i`m trying to use pexpect but > following code gives me an something strange as a result. When working with pexpect, logging the entire conversation is extremely useful fro debugging > import pex

Re: popen and password entry

2006-06-14 Thread Sinan Nalkaya
hi,i have found expect method for this purpose. i`m trying to use pexpect but following code gives me an something strange as a result.# The CODEimport pexpectcmd = '/usr/bin/rsync config [EMAIL PROTECTED]:/tmp/.' #cmd = 'ssh [EMAIL PROTECTED]'child = pexpect.spawn(cmd)passwd = 'qwe123'try:   

popen and password entry

2006-06-14 Thread sinan nalkaya
hello, i want to use rsync for remote file transfer via popen, but couldnt pass the Password yet. here`s what i did cmd = 'rsync -av config [EMAIL PROTECTED]:/tmp/.' f = os.popen(cmd,'w') f.write('1234') #not worked f.write('1234\n') #not worked every time i see "Password:" line, then i tried p

Re: popen and password entry

2006-06-14 Thread Ganesan Rajagopal
> sinan nalkaya <[EMAIL PROTECTED]> writes: > i want to use rsync for remote file transfer via popen, but couldnt pass > the Password yet. For interactive input try the pexpect module instead of popen (see http://pexpect.sf.net). Ganesan -- Ganesan Rajagopal -- http://mail.python.org/ma

popen and password entry

2006-06-14 Thread sinan nalkaya
hello, i want to use rsync for remote file transfer via popen, but couldnt pass the Password yet. here`s what i did cmd = 'rsync -av config [EMAIL PROTECTED]:/tmp/.' f = os.popen(cmd,'w') f.write('1234') #not worked f.write('1234\n') #not worked every time i see "Password:" line, then i tried p