On Jan 29, 12:27 pm, Rob Wolfe <[EMAIL PROTECTED]> wrote: > "[EMAIL PROTECTED]" <[EMAIL PROTECTED]> writes: > > I am having some issues writing a telnet program, using telnetlib. I > > am not sure if it is the telnet on the connections end or it is my > > program. > > > A little background, when I log in straight from the Linux Command > > prompt. The only thing I get is a blinking cursor. Then I type in my > > command 'FOO' enter then screen on the very next line returns 'OK', > > Then automatically puts the blinking cursor on the next line. Then > > when I want to quit the telnet session I hit CTRL+Z that takes me to > > telnet> then i type quit. > > > My Program currently looks like it connects. Because the last string > > that I get back that is not blank says: "Logged in successfully". > > > So my problem is that when I issue the command through tn.write("FOO > > \n"). Then do a tn.read_until('OK\n', 10). It gets returned nothing. I > > have also added tn.read_until('OK\n', 10).splitlines(). That is also > > returned blank. > > > I have tried various different newlines \n \r \r\n. All the > > documentation for telnet program that I am logging into says, use > > Carriage Return after each command. Nothing seems to get back the > > data. I am not sure if the Python telnet is looking for more of true > > command line like telnet>. > > Have you tried: tn.set_debuglevel(1) ? > > HTH, > Rob
Thank You for the response. I did set the debugging level. I get back this. Telnet(192.168.2.75,5000): recv 'Password: ' Telnet(192.168.2.75,5000): send '*****\n' Telnet(192.168.2.75,5000): recv '\r\x00\r\nlogged in successfully\r\n' Telnet(192.168.2.75,5000): send '\n\n' Telnet(192.168.2.75,5000): Sending AT Telnet(192.168.2.75,5000): send 'AT\r\n' Telnet(192.168.2.75,5000): recv '\r\x00' So I on this command I should be getting back a 'OK' or 'ERROR'. But I am not seeing it. I feel like I am missing something. Not sure what would be the or is it the telnet application itself. Thanks, Paul -- http://mail.python.org/mailman/listinfo/python-list