Use pexpect: http://pexpect.sourceforge.net/

flupke schrieb:
> Hi,
> 
> i made a backup script to backup my postgres database.
> Problem is that it prompts for a password. It thought i
> could solve this by using popen2.
> I tested popen2 with dir (i'm on windows 2000, python 2.4.3)
> and it works.
> However when i try popen2 and my pg_dump command, it prompts
> for a password and I was under the impression that i was
> going to be able to dynamically communicate with the process.
> 
> sin, sout = popen2(backup_command)
> sin.readline() # the password prompt
> sout.write("password")
> sin.readlines()
> 
> How can i catch the password prompt and feed the password
> from my code?
> 
> Thanks,
> Benedict

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to