[Tutor] Maybe advanced pexpect question?
nomb85 at comcast.net
Wed Mar 26 03:01:23 CET 2008
I'm thinking more along the lines as of running a program, sending tab
to get to the field send text to put on the field, tab, send text ?
On Sun, 2008-03-23 at 14:00 -0500, mwalsh wrote:
> Kent Johnson wrote:
> > Nathan McBride wrote:
> >> I've used pexpect for a few projects and love it. Basically pexpect
> >> lets you spawn a program and interact with it from code like you
> >> yourself were running it in a console. How would you send the ctrl key?
> > I don't use pexpect, so I am guessing...
> > The ctrl key by itself is not a character so you can't send that. ctrl-C
> > is a character that is represented in a string as \x03. I expect you
> > would send a control character with sendline(), for example to sent
> > ctrl-C try
> > child.sendline ('\x03')
> In recent versions of pexpect (I'm looking at 2.3), 'spawn' objects
> include a sendcontrol method which does almost exactly that for cntl-c,
> with send instead of sendline.
> > Kent
> > _______________________________________________
> > Tutor maillist - Tutor at python.org
> > http://mail.python.org/mailman/listinfo/tutor
> Tutor maillist - Tutor at python.org
More information about the Tutor