Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #76286
| References | <f6f7175a-37cc-44d0-9e62-b237f51d6ac8@googlegroups.com> |
|---|---|
| Date | 2014-08-14 19:14 +1000 |
| Subject | Re: pexpect - logging input AND output |
| From | Chris Angelico <rosuav@gmail.com> |
| Newsgroups | comp.lang.python |
| Message-ID | <mailman.12986.1408007694.18130.python-list@python.org> (permalink) |
On Thu, Aug 14, 2014 at 6:59 PM, <sj.constantine@gmail.com> wrote:
> i have a script running a few commands on a network device. i can't seem to figure out how to log both the input and output of what the pexpect script initiates and responds to.
>
> child = pexpect.spawn ('telnet '+ ip)
If that's not working for you, would it be easier instead to simply
open a socket connection to port 23 on that IP address? Then you'd
just write to the socket (and log what you write) and read from it
(and log that). It's possible you'll see some TELNET or ANSI codes
coming back, but I expect you won't have to send any of them.
ChrisA
Back to comp.lang.python | Previous | Next — Previous in thread | Next in thread | Find similar | Unroll thread
pexpect - logging input AND output sj.constantine@gmail.com - 2014-08-14 01:59 -0700 Re: pexpect - logging input AND output Chris Angelico <rosuav@gmail.com> - 2014-08-14 19:14 +1000 Re: pexpect - logging input AND output Akira Li <4kir4.1i@gmail.com> - 2014-08-20 18:51 +0400
csiph-web