title: telnetlib and "buf = self.sock.recv(50)" error
body: <p>I am using telnetlib for simple telnet script to Juniper switch. Below is my code:</p>
  
  <pre><code>import telnetlib
  
  HOST = raw_input("Enter host IP address: ")  
  USER = raw_input("Enter Username: ")  
  PWD = raw_input("Enter Password: ")  
  TNT = telnetlib.Telnet(HOST, 23, 10)  
  TNT.read_until("login:")  
  TNT.write(USER.encode('ascii') + "\n")  
  TNT.read_until("Password:")  
  TNT.write(PWD.encode('ascii') + "\n")  
  TNT.write("set cli screen-length 10000\nconfigure\nshow\nexit\n")  
  print (TNT.read_all().decode('ascii'))  
  TNT.close()  
  raw_input ("Press any Key to Quit: ")  
  </code></pre>
  
  <p>Whenever I run this program with Juniper switch it gives me this error:  </p>
  
  <pre><code>Traceback (most recent call last):  
    File "D:\Python\AuTel Project\Old versions and tials\Telnet (Python 2.7) V1.4.py", line 17, in &lt;module&gt;  
      print (TNT.read_all().decode('ascii'))  
    File "C:\Python27\lib\telnetlib.py", line 325, in read_all  
      self.fill_rawq()  
    File "C:\Python27\lib\telnetlib.py", line 516, in fill_rawq  
      buf = self.sock.recv(50)  
  timeout: timed out
  </code></pre>
  
  <p>I have faced this problem before with Cisco and Nortel, but I could overcome it with "terminal lenght 0" command on Cisco and similar comand on Nortel. I tried to use the equivalent command on Juniper (set cli screen-length), but I am still getting the same error. I need to know what is the meaning of this error and what is the reason of it, and how to overcome it.</p>
  
  <p>Best Regards,</p>