Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #62053 > unrolled thread
| Started by | Jean-Michel Pichavant <jeanmichel@sequans.com> |
|---|---|
| First post | 2013-12-16 13:05 +0100 |
| Last post | 2013-12-16 05:38 -0800 |
| Articles | 2 — 2 participants |
Back to article view | Back to comp.lang.python
Re: [newbie] trying socket as a replacement for nc Jean-Michel Pichavant <jeanmichel@sequans.com> - 2013-12-16 13:05 +0100
Re: [newbie] trying socket as a replacement for nc Jean Dubois <jeandubois314@gmail.com> - 2013-12-16 05:38 -0800
| From | Jean-Michel Pichavant <jeanmichel@sequans.com> |
|---|---|
| Date | 2013-12-16 13:05 +0100 |
| Subject | Re: [newbie] trying socket as a replacement for nc |
| Message-ID | <mailman.4209.1387195543.18130.python-list@python.org> |
> Here is the code:
> #!/usr/bin/env python
> import telnetlib
> host = '10.128.59.63'
> port = 7000
> t = Telnet(host, port)
> t.write('*IDN?\n')
> print t.read_until('Whateverprompt')
> # you can use read_very_eager also
>
> and this is the result of executing the code(from which I deduce I
> have to
> install telnetlib, but how?)
> Traceback (most recent call last):
> File "./nctelnet.py", line 5, in <module>
> t = Telnet(host, port)
> NameError: name 'Telnet' is not defined
>
> kind regards,
> jean
t = telnetlib.Telnet(host, port)
JM
-- IMPORTANT NOTICE:
The contents of this email and any attachments are confidential and may also be privileged. If you are not the intended recipient, please notify the sender immediately and do not disclose the contents to any other person, use it for any purpose, or store or copy the information in any medium. Thank you.
[toc] | [next] | [standalone]
| From | Jean Dubois <jeandubois314@gmail.com> |
|---|---|
| Date | 2013-12-16 05:38 -0800 |
| Message-ID | <49171740-daca-40da-9073-4551956c8354@googlegroups.com> |
| In reply to | #62053 |
Op maandag 16 december 2013 13:05:41 UTC+1 schreef Jean-Michel Pichavant:
> > Here is the code:
> > #!/usr/bin/env python
> > import telnetlib
> > host = '10.128.59.63'
> > port = 7000
> > t = Telnet(host, port)
> > t.write('*IDN?\n')
> > print t.read_until('Whateverprompt')
> > # you can use read_very_eager also
> >
> > and this is the result of executing the code(from which I deduce I
> > have to
> > install telnetlib, but how?)
> > Traceback (most recent call last):
> > File "./nctelnet.py", line 5, in <module>
> > t = Telnet(host, port)
> > NameError: name 'Telnet' is not defined
> >
> > kind regards,
> > jean
> t = telnetlib.Telnet(host, port)
this helps, but I don't know what to do with
"print t.read_until('Whateverprompt')"
should I send CTRL-ALT-ALTGR-] after some time?
kind regards,
jean
[toc] | [prev] | [standalone]
Back to top | Article view | comp.lang.python
csiph-web