For more details, please see ourCookie Policy.

Management Software

Occasional Visitor
Posts: 1
Registered: ‎02-08-2018 function doesn%27t work

[ Edited ]

Hello Folk's,


Trying to telnet to a Brocade router and the python script is sending out error.... Not sure what is wrong here. Have tried a debug but cant make it working. I believe it's prompt issue. I appreciate if anyone has suggestion how to get it work.


Note: This is Python 3.0


import getpass
import sys
import telnetlib

HOST = ""
user = "admin"
password = "password"
port = "23"

telnet = telnetlib.Telnet(HOST)

telnet.read_until("sw0 login:,3")

telnet.write(admin + "\r")
if password:
    telnet.read_until("Password: ")
    telnet.write(password + "\n")

tn.write("term len 0" + "\n")
telnet.write("sh ver br\n")


Traceback (most recent call last):
  File "C:\Users\milan\Desktop\", line 13, in <module>
    telnet.read_until("Username :,3")
  File "C:\Python33\lib\", line 299, in read_until
    return self._read_until_with_select(match, timeout)
  File "C:\Python33\lib\", line 352, in _read_until_with_select
    i = self.cookedq.find(match)
TypeError: Type str doesn't support the buffer API

This is my prompt after logging manually using telnet port 23 and this is what i expected command to work.

Network OS (sw0)

sw0 login: xxxxx
Password:  xxxxx

WARNING: The default password of 'admin' and 'user' accounts have not been changed.

Welcome to the Brocade Network Operating System Software
admin connected from using console on sw0
sw0# sh ver


"edited removed links - Community Manager -  released from quarantine "



Join the Broadcom Support Community

Get quick and easy access to valuable resources across the Broadcom Community Network.