Get pexpect to work

Jurian Sluiman jurian at juriansluiman.nl
Sun Oct 29 15:56:57 EST 2006


Ok, somebody helped my and found with "help(child.sendline)" that the
number (7) is the number of characters from my password.

Still there doesn't seem to be that anything strange is happening. With
the logfile printed out, I found that child.expect places a 0 behind the
next rule. Is this always what's happening? And is that 0 causing all my
troubles?

I'm a newbie with python, so I don't know much about it. This is (again)
the output, but with a sys.stdout line between it:

>>> child = pexpect.spawn("vpnc-connect tudelft\ nopass.conf")
>>> child.logfile = sys.stdout
>>> child.expect(".* password .*: ")
Enter password for wb1264222 at luchtbrug.tudelft.nl: 0
>>> child.sendline("[my_password]")
7

Any help is really appreciated! I can search on the Internet, but with no
clue to search for and which keywords to use, all results don't help me.

Thanks,
Jurian

PS. Sorry for my bad English, I hope you can understand it.



More information about the Python-list mailing list