read_all()" to read data from a cisco device.
some time it reads the data and sometime it won't read and gives empty string.
I tried below 2 commands but still it's not consitently reading data.
print 'Commands issued............'
#ISSUE COMMANDS VIA TELNET
tn.write("term len 0\r")
print 'Read telnet data............'
#READ TELNET DATA
print 'Telnet data read successfully............'
I too faced the same problem..This would help:
tn = telnetlib.Telnet('220.127.116.11') tn.write('ls \r\n') data = '' while data.find('#') == -1: data = tn.read_very_eager() print data
This snippet reads the info after a command being executed. And reads till '#' prompt is shown.