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


Groups > comp.lang.python > #39899

Re: telnet to Cognex In-Sight 4001 camera

Return-Path <python@mrabarnett.plus.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.006
X-Spam-Evidence '*H*': 0.99; '*S*': 0.00; 'sys': 0.05; 'returned.': 0.07; 'username,': 0.07; 'python': 0.09; 'pressing': 0.09; '2.7': 0.13; '"..."': 0.16; 'from:addr:mrabarnett.plus.com': 0.16; 'from:addr:python': 0.16; 'from:name:mrab': 0.16; 'isnt': 0.16; 'message-id:@mrabarnett.plus.com': 0.16; 'skip:> 20': 0.16; 'telnetlib': 0.16; 'string': 0.17; 'wrote:': 0.17; 'typing': 0.17; 'windows': 0.19; 'equivalent': 0.20; 'skip:" 30': 0.20; '"",': 0.22; 'assuming': 0.22; 'help.': 0.22; "haven't": 0.23; 'raise': 0.24; 'command': 0.24; 'header:In-Reply-To:1': 0.25; 'header:User- Agent:1': 0.26; 'appreciated.': 0.26; '(most': 0.27; 'older': 0.27; 'wonder': 0.27; 'skip:> 10': 0.27; '>>>>': 0.29; 'initiate': 0.29; 'connection': 0.30; 'ends': 0.30; 'returned': 0.30; 'file': 0.32; 'traceback': 0.33; 'to:addr:python-list': 0.33; 'code:': 0.33; 'weeks': 0.33; 'but': 0.36; 'should': 0.36; 'communicate': 0.37; 'subject:: ': 0.38; 'instead': 0.39; 'to:addr:python.org': 0.39; 'received:192': 0.39; 'hello,': 0.39; 'skip:" 10': 0.40; 'received:192.168': 0.40; 'subject:-': 0.40; 'help': 0.40; '(that': 0.62; 'email addr:gmail.com': 0.63; 'dont': 0.64; 'here': 0.65; 'camera': 0.65; 'header:Reply-To:1': 0.68; 'reply-to:no real name:2**0': 0.72; 'hoping': 0.72; 'prompt': 0.78; 'presumably': 0.84; 'reply-to:addr:python.org': 0.84
X-CM-Score 0.00
X-CNFS-Analysis v=2.0 cv=XeZXOvF5 c=1 sm=1 a=0nF1XD0wxitMEM03M9B4ZQ==:17 a=_vX2mLoUpDQA:10 a=6OfO6lV-XOQA:10 a=ihvODaAuJD4A:10 a=OUOv7kDek9cA:10 a=8nJEP1OIZ-IA:10 a=EBOSESyhAAAA:8 a=8AHkEIZyAAAA:8 a=t4ZJgjsAmVQA:10 a=pGLkceISAAAA:8 a=PrVsvAczhoQl3jWkY1oA:9 a=wPNLvfGTeEIA:10 a=MSl-tDqOz04A:10 a=0nF1XD0wxitMEM03M9B4ZQ==:117
X-AUTH mrabarnett:2500
Date Mon, 25 Feb 2013 17:29:54 +0000
From MRAB <python@mrabarnett.plus.com>
User-Agent Mozilla/5.0 (Windows NT 5.1; rv:17.0) Gecko/20130215 Thunderbird/17.0.3
MIME-Version 1.0
To python-list@python.org
Subject Re: telnet to Cognex In-Sight 4001 camera
References <d0462043-2195-4272-b13d-fd04d1d87695@googlegroups.com>
In-Reply-To <d0462043-2195-4272-b13d-fd04d1d87695@googlegroups.com>
Content-Type text/plain; charset=ISO-8859-1; format=flowed
Content-Transfer-Encoding 7bit
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
Reply-To python-list@python.org
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <http://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <http://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Newsgroups comp.lang.python
Message-ID <mailman.2511.1361813390.2939.python-list@python.org> (permalink)
Lines 38
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361813390 news.xs4all.nl 6893 [2001:888:2000:d::a6]:49364
X-Complaints-To abuse@xs4all.nl
Path csiph.com!usenet.pasdenom.info!news.stben.net!border3.nntp.ams.giganews.com!border1.nntp.ams.giganews.com!nntp.giganews.com!news2.euro.net!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Xref csiph.com comp.lang.python:39899

Show key headers only | View raw


On 2013-02-25 17:02, chris.annin@gmail.com wrote:
> 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:"

The returned string ends with "User:", presumably the prompt to enter
the username, which makes we wonder whether you should be reading until
"User:" instead of until "Login: ".

>>>>tn.write(USER + "\r\n")

Should you be ending that with just "\r" or just "\n" instead? (That
would be equivalent to typing the username and then pressing the Return
key.)

>>>>tn.read_until("User: ")

Haven't you already seen "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.
>

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

telnet to Cognex In-Sight 4001 camera chris.annin@gmail.com - 2013-02-25 09:02 -0800
  Re: telnet to Cognex In-Sight 4001 camera MRAB <python@mrabarnett.plus.com> - 2013-02-25 17:29 +0000
    Re: telnet to Cognex In-Sight 4001 camera chris.annin@gmail.com - 2013-02-25 11:48 -0800
    Re: telnet to Cognex In-Sight 4001 camera chris.annin@gmail.com - 2013-02-25 11:48 -0800
  Re: telnet to Cognex In-Sight 4001 camera chris.annin@gmail.com - 2013-02-25 17:16 -0800
    Re: telnet to Cognex In-Sight 4001 camera Roy Smith <roy@panix.com> - 2013-02-25 20:44 -0500

csiph-web