Get pexpect to work

Jurian Sluiman jurian at
Sat Oct 28 23:14:53 CEST 2006

Hi all,
I'm trying to build a program to set up a vpn connection. I'm using
pexpect to handle this, but I can't get it to work. 
The sendline() is causing troubles. I tested it in the interactive
promt, with these results:

>>> import pexpect
>>> child = pexpect.spawn("vpnc-connect tudelft\ nopass.conf")
>>> child.expect(".* password .*: ")
>>> child.sendline("[here_my_password]")

The sendline returns an exit code 7, but I don't what it should be. I
saw an example here, where sendline returns an exit code 10: After this peace of
code, I don't have a vpn connection. I'm sure my password is correct.
What's going wrong?

Thanks in advance,
Jurian Sluiman

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list