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


Groups > comp.lang.python > #39910

Re: telnet to Cognex In-Sight 4001 camera

Path csiph.com!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed1.news.xs4all.nl!xs4all!newsgate.cistron.nl!newsgate.news.xs4all.nl!post.news.xs4all.nl!not-for-mail
Return-Path <chris.annin@gmail.com>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'mrab': 0.05; 'sys': 0.05; 'emulate': 0.07; 'returned.': 0.07; 'username,': 0.07; 'python': 0.09; 'pressing': 0.09; 'to:addr:comp.lang.python': 0.09; 'cc:addr :python-list': 0.10; '2.7': 0.13; 'read.': 0.13; '"..."': 0.16; '"\\r\\n"': 0.16; 'isnt': 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; 'cc:2**0': 0.23; 'work.': 0.23; 'monday,': 0.23; "haven't": 0.23; 'raise': 0.24; 'cc:no real name:2**0': 0.24; 'command': 0.24; 'tried': 0.25; 'cc:addr:python.org': 0.25; '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; 'didnt': 0.29; 'initiate': 0.29; 'connection': 0.30; 'ends': 0.30; 'returned': 0.30; 'file': 0.32; 'traceback': 0.33; 'code:': 0.33; 'weeks': 0.33; 'received:google.com': 0.34; 'doing': 0.35; 'received:209.85.220': 0.35; 'received:209.85': 0.35; 'there': 0.35; 'but': 0.36; 'should': 0.36; 'option': 0.37; 'communicate': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'nothing': 0.38; 'instead': 0.39; 'hello,': 0.39; 'skip:" 10': 0.40; 'subject:-': 0.40; 'help': 0.40; 'from:no real name:2**0': 0.60; '(that': 0.62; 'email addr:gmail.com': 0.63; 'dont': 0.64; 'here': 0.65; 'charset:windows-1252': 0.65; 'camera': 0.65; 'hoping': 0.72; 'prompt': 0.78; '2013': 0.84; 'difference.': 0.84; 'presumably': 0.84
X-Received by 10.49.24.13 with SMTP id q13mr1141926qef.33.1361821726650; Mon, 25 Feb 2013 11:48:46 -0800 (PST)
Newsgroups comp.lang.python
Date Mon, 25 Feb 2013 11:48:46 -0800 (PST)
In-Reply-To <mailman.2511.1361813390.2939.python-list@python.org>
Complaints-To groups-abuse@google.com
Injection-Info glegroupsg2000goo.googlegroups.com; posting-host=199.181.155.130; posting-account=NWckLgoAAAA_ESRKeclDK3J-ZCP6LE-U
References <d0462043-2195-4272-b13d-fd04d1d87695@googlegroups.com> <mailman.2511.1361813390.2939.python-list@python.org>
User-Agent G2/1.0
X-Google-Web-Client true
X-Google-IP 199.181.155.130
MIME-Version 1.0
Subject Re: telnet to Cognex In-Sight 4001 camera
From chris.annin@gmail.com
To comp.lang.python@googlegroups.com
Content-Type text/plain; charset=windows-1252
Content-Transfer-Encoding quoted-printable
Cc python-list@python.org
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.15
Precedence list
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>
Message-ID <mailman.2520.1361822516.2939.python-list@python.org> (permalink)
Lines 86
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361822516 news.xs4all.nl 6939 [2001:888:2000:d::a6]:52712
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39910

Show key headers only | View raw


On Monday, February 25, 2013 9:29:54 AM UTC-8, MRAB wrote:
> 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 "", line 1, in 
> 
> >    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.
> 

yea you are right I shouldnt be doing read_until("User: ") I tried read_until("Password: ") instead but didnt make any difference.  If I use read_all() I just get ,,, like there is nothing to read.  in hyperterminal I had to set the “Send Line Ends with Line Feeds” option for it to work.  I thought by using "\r\n" would emulate the same thing?

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