Go Back   Rhinocerus > Newsgroup > Newsgroup comp.lang.python

Reply
 
Thread Tools Display Modes
  #1 (permalink)  
Old 03-10-2010, 01:10 PM
Jean-Michel Pichavant
Guest
 
Posts: n/a
Default Re: about Telnetlib problem

JEHERUL wrote:
> Dear All
>
> I am trying to telnet to a Cisco router . Following is my code .
>
> #code router.py
>
> import getpass
> import sys
> import telnetlib
>
> HOST = "router address" # router address is ommitted for
> security reason
> user = raw_input("Username : ")
> password = getpass.getpass()
>
> tn = telnetlib.Telnet(HOST)
>
> tn.read_until("Username: ")
> tn.write(user + "\n")
> tn.read_until("Password: ")
> tn.write(password + "\n")
>
>
> tn.read_until("I>")
> tn.write("sh int f0/0")
>
> print "Just to check"
>
>
> print tn.read_all()
>
> print "after read"
> tn.write("exit\n")
>
>
>
> But when I execute the program I got the following error .
>
>
> Traceback (most recent call last):
> File "router.py", line 23, in ?
> print tn.read_all()
> File "/usr/lib/python2.4/telnetlib.py", line 330, in read_all
> self.fill_rawq()
> File "/usr/lib/python2.4/telnetlib.py", line 521, in fill_rawq
> buf = self.sock.recv(50)
>
> Please help me .
>
> Regards
> --
> Jeherul Islam
> Indian Institute of Information Technology and Management .
> Gwalior (MP)
>
>

Hi,

Your error trace is incomplete it's missing the exception. It would be
better if you provide it.

JM
Reply With Quote
Alt Today
Advertising
 
and become member of Rhinocerus
Standard Sponsored Links

Reply

Popular Tags in the Forum
problem, telnetlib

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are Off
Pingbacks are Off
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
JSLint Reports on last 2 Production Versions of jQuery lorlarz Newsgroup comp.lang.javascript 107 03-09-2010 08:51 AM
Is there any more benifits by virtual inheritance than resolving the"diamond problem" ? thomas Newsgroup comp.language.c++ 9 11-27-2009 12:08 PM
Re: can anybody help this problem Lewis Jordan Newsgroup comp.soft-sys.sas 0 02-18-2009 03:12 PM
Re: Update: SAS/InrNet Application Dispatcher Problem Alan Churchill Newsgroup comp.soft-sys.sas 1 12-09-2007 03:59 AM
Re: SAS Problem nospam@HOWLES.COM (Howard Schreier Newsgroup comp.soft-sys.sas 0 05-03-2006 03:23 AM



All times are GMT. The time now is 06:51 PM.


Copyright ©2009

LinkBacks Enabled by vBSEO 3.3.0 RC2 © 2009, Crawlability, Inc.