Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #39905 > unrolled thread

Re: telnet to Cognex In-Sight 4001 camera

Started by"square.steve" <square.steve@gmail.com>
First post2013-02-25 20:24 +0100
Last post2013-02-25 11:42 -0800
Articles 3 — 2 participants

Back to article view | Back to comp.lang.python


Contents

  Re: telnet to Cognex In-Sight 4001 camera "square.steve" <square.steve@gmail.com> - 2013-02-25 20:24 +0100
    Re: telnet to Cognex In-Sight 4001 camera chris.annin@gmail.com - 2013-02-25 11:42 -0800
    Re: telnet to Cognex In-Sight 4001 camera chris.annin@gmail.com - 2013-02-25 11:42 -0800

#39905 — Re: telnet to Cognex In-Sight 4001 camera

From"square.steve" <square.steve@gmail.com>
Date2013-02-25 20:24 +0100
SubjectRe: telnet to Cognex In-Sight 4001 camera
Message-ID<mailman.2517.1361820275.2939.python-list@python.org>

[Multipart message — attachments visible in raw view] — view raw

At the risk of stating the blindingly obvious, have you run a 'real' telnet session to see what  a successful conversation looks like? Might give you some useful pointers for your debug session.

Steve


Sent from a Galaxy far, far away....

-------- Original message --------
From: chris.annin@gmail.com 
Date:  
To: python-list@python.org 
Subject: telnet to Cognex In-Sight 4001 camera 
 
Hello,  ive been struggling with this for a couple weeks now and was hoping someone might be able to help.  I have an older Cognex camera that I need to communicate with via telnet.  I can get a response from the camera when I initiate a telnet session but I dont seem to get any response when I write the user name to the camera -  I havnt been able to get any response writing anything. Im using python 2.7 and windows xp.  here is the code:
[code]
>>>import sys
>>>import telnetlib
>>>HOST = "10.31.18.21"
>>>USER = "admin"
>>>tn = telnetlib.Telnet(HOST)
>>>tn.read_until("Login: ")
"Welcome to In-Sight(R) 4001 Session 1\r\nUser:"
>>>tn.write(USER + "\r\n")
>>>tn.read_until("User: ")
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "C:\Python27\lib\telnetlib.py", line 319,
    return self.read_very_lazy()
  File "C:\Python27\lib\telnetlib.py", line 395,
    raise EOFError, 'telnet connection closed'
EOFError: telnet connection closed
>>>
[\code]

if i do a read_all instead of read_until for user I just get "..." returned.  Im assuming tn.write command isnt working?  any help would be greatly appreciated.

thank you

Chris
-- 
http://mail.python.org/mailman/listinfo/python-list

[toc] | [next] | [standalone]


#39906

Fromchris.annin@gmail.com
Date2013-02-25 11:42 -0800
Message-ID<278f6415-eeae-4934-bef5-28f25edc3d5c@googlegroups.com>
In reply to#39905
yes, ive connected successfully using hyperterminal after I login it asks for user and I type admin press enter then it ask for password and type password press enter and it all works fine. using python ive tried ending both with "\n" and "\r\n" im thoroughly confused   




On Monday, February 25, 2013 11:24:22 AM UTC-8, square.steve wrote:
> At the risk of stating the blindingly obvious, have you run a 'real' telnet session to see what  a successful conversation looks like? Might give you some useful pointers for your debug session.
> 
> 
> Steve
> 
> 
> 
> Sent from a Galaxy far, far away....  
> 
> 
> -------- Original message --------
> From: chris...@gmail.com 
> Date:  
> To: pytho...@python.org 
> Subject: telnet to Cognex In-Sight 4001 camera 
>  
> 
> Hello,  ive been struggling with this for a couple weeks now and was hoping someone might be able to help.  I have an older Cognex camera that I need to communicate with via telnet.  I can get a response from the camera when I initiate a telnet session but I dont seem to get any response when I write the user name to the camera -  I havnt been able to get any response writing anything. Im using python 2.7 and windows xp.  here is the code:
> [code]
> >>>import sys
> >>>import telnetlib
> >>>HOST = "10.31.18.21"
> >>>USER = "admin"
> >>>tn = telnetlib.Telnet(HOST)
> >>>tn.read_until("Login: ")
> "Welcome to In-Sight(R) 4001 Session 1\r\nUser:"
> >>>tn.write(USER + "\r\n")
> >>>tn.read_until("User: ")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Python27\lib\telnetlib.py", line 319,
>     return self.read_very_lazy()
>   File "C:\Python27\lib\telnetlib.py", line 395,
>     raise EOFError, 'telnet connection closed'
> EOFError: telnet connection closed
> >>>
> [\code]
> 
> if i do a read_all instead of read_until for user I just get "..." returned.  Im assuming tn.write command isnt working?  any help would be greatly appreciated.
> 
> thank you
> 
> Chris
> -- 
> http://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [next] | [standalone]


#39908

Fromchris.annin@gmail.com
Date2013-02-25 11:42 -0800
Message-ID<mailman.2518.1361821869.2939.python-list@python.org>
In reply to#39905
yes, ive connected successfully using hyperterminal after I login it asks for user and I type admin press enter then it ask for password and type password press enter and it all works fine. using python ive tried ending both with "\n" and "\r\n" im thoroughly confused   




On Monday, February 25, 2013 11:24:22 AM UTC-8, square.steve wrote:
> At the risk of stating the blindingly obvious, have you run a 'real' telnet session to see what  a successful conversation looks like? Might give you some useful pointers for your debug session.
> 
> 
> Steve
> 
> 
> 
> Sent from a Galaxy far, far away....  
> 
> 
> -------- Original message --------
> From: chris...@gmail.com 
> Date:  
> To: pytho...@python.org 
> Subject: telnet to Cognex In-Sight 4001 camera 
>  
> 
> Hello,  ive been struggling with this for a couple weeks now and was hoping someone might be able to help.  I have an older Cognex camera that I need to communicate with via telnet.  I can get a response from the camera when I initiate a telnet session but I dont seem to get any response when I write the user name to the camera -  I havnt been able to get any response writing anything. Im using python 2.7 and windows xp.  here is the code:
> [code]
> >>>import sys
> >>>import telnetlib
> >>>HOST = "10.31.18.21"
> >>>USER = "admin"
> >>>tn = telnetlib.Telnet(HOST)
> >>>tn.read_until("Login: ")
> "Welcome to In-Sight(R) 4001 Session 1\r\nUser:"
> >>>tn.write(USER + "\r\n")
> >>>tn.read_until("User: ")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "C:\Python27\lib\telnetlib.py", line 319,
>     return self.read_very_lazy()
>   File "C:\Python27\lib\telnetlib.py", line 395,
>     raise EOFError, 'telnet connection closed'
> EOFError: telnet connection closed
> >>>
> [\code]
> 
> if i do a read_all instead of read_until for user I just get "..." returned.  Im assuming tn.write command isnt working?  any help would be greatly appreciated.
> 
> thank you
> 
> Chris
> -- 
> http://mail.python.org/mailman/listinfo/python-list

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web