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


Groups > comp.lang.python > #39911

Re: telnet to Cognex In-Sight 4001 camera

Path csiph.com!usenet.pasdenom.info!weretis.net!feeder1.news.weretis.net!feeder.erje.net!eu.feeder.erje.net!xlned.com!feeder5.xlned.com!news2.euro.net!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.000
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'debug': 0.05; 'sys': 0.05; 'returned.': 0.07; 'session.': 0.07; 'python': 0.09; '"\\n")': 0.09; '&quot;)': 0.09; 'pointers': 0.09; 'stating': 0.09; 'cc:addr :python-list': 0.10; '2.7': 0.13; 'steve': 0.13; '"),': 0.16; '"..."': 0.16; 'away....': 0.16; 'galaxy': 0.16; 'input.': 0.16; 'isnt': 0.16; 'received:209.85.216.53': 0.16; 'skip:> 20': 0.16; 'telnetlib': 0.16; 'tried:': 0.16; 'mon,': 0.16; 'wrote:': 0.17; '>>>': 0.18; 'windows': 0.19; 'feb': 0.19; 'email addr:gmail.com&gt;': 0.20; 'skip:" 30': 0.20; 'error.': 0.21; '"",': 0.22; '&gt;&gt;&gt;': 0.22; 'assuming': 0.22; 'combination': 0.22; 'help.': 0.22; 'cc:2**0': 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; 'looks': 0.26; 'appreciated.': 0.26; '(most': 0.27; 'am,': 0.27; 'older': 0.27; 'skip:> 10': 0.27; 'message-id:@mail.gmail.com': 0.27; '--------': 0.28; 'chris': 0.28; 'run': 0.28; 'far,': 0.29; 'initiate': 0.29; 'date:': 0.29; 'url:mailman': 0.29; 'skip:& 10': 0.29; 'connection': 0.30; 'skip:& 30': 0.30; 'url:python': 0.32; 'file': 0.32; 'url:listinfo': 0.32; 'traceback': 0.33; 'code:': 0.33; 'weeks': 0.33; 'skip:& 20': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'received:209.85': 0.35; 'really': 0.36; 'subject:': 0.36; 'but': 0.36; 'url:org': 0.36; 'email addr:python.org': 0.36; 'useful': 0.36; 'thank': 0.36; 'communicate': 0.37; 'received:209': 0.37; 'far': 0.37; 'received:209.85.216': 0.37; 'subject:: ': 0.38; 'from:': 0.38; 'some': 0.38; 'gives': 0.39; 'instead': 0.39; 'hello,': 0.39; 'skip:" 10': 0.40; 'subject:-': 0.40; 'help': 0.40; 'url:mail': 0.40; 'think': 0.40; 'your': 0.60; 'back': 0.62; 'email name :python-list': 0.62; 'email addr:gmail.com': 0.63; 'dont': 0.64; 'here': 0.65; 'camera': 0.65; 'risk': 0.66; 'hoping': 0.72; '2013': 0.84; 'conversation': 0.91; 'obvious,': 0.91
DKIM-Signature v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:x-received:in-reply-to:references:date:message-id :subject:from:to:cc:content-type; bh=lRRMtVECyZQn/1ZkX+NN2wG6vdOpvWP2BJ2gCq/tE5Q=; b=mfpgACXXdK9Szut1ERg0fRNNYu4sqqt0NKzzfApyDCFcHnj5fh63qSQD30lRYCoOvl 4IeudAF+fdPHmdCkWaPAXiEdMsjE00QkrHClC964NKBOT/UVVNLeWu1+/Edwcuz1iD2l PqlQEf744DdZh7Q7TGIxP7cihqFJOEkNRKkfpipGXtcM4gjsnjx+gn/6dlOGncwd2AUh qIG1HDUS6CHEfhaWR3lvbRrMDWxASB07/6xaML2qhFuRceG5QVjeu4qX994JY88zMmJZ SQ0tzgpYbosI7rxm2KS/Tfzb+UGqywJsvffxJ/wV+jwlPbtwW8kXOCVoDxFjsM5yowKx +5Ag==
MIME-Version 1.0
X-Received by 10.224.110.1 with SMTP id l1mr13404503qap.21.1361824038038; Mon, 25 Feb 2013 12:27:18 -0800 (PST)
In-Reply-To <9qya2949lwvwn69b2oqy5xya.1361820262242@email.android.com>
References <9qya2949lwvwn69b2oqy5xya.1361820262242@email.android.com>
Date Mon, 25 Feb 2013 12:27:17 -0800
Subject Re: telnet to Cognex In-Sight 4001 camera
From Chris Annin <chris.annin@gmail.com>
To "square.steve" <square.steve@gmail.com>
Content-Type multipart/alternative; boundary=20cf3074d56008b52204d6925ef0
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>
Newsgroups comp.lang.python
Message-ID <mailman.2521.1361824040.2939.python-list@python.org> (permalink)
Lines 141
NNTP-Posting-Host 2001:888:2000:d::a6
X-Trace 1361824040 news.xs4all.nl 6970 [2001:888:2000:d::a6]:60729
X-Complaints-To abuse@xs4all.nl
Xref csiph.com comp.lang.python:39911

Show key headers only | View raw


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

Ive tried: read_until("Login: "), read_until("User: ") and read_all()  all
3 ways return the same thing: "Welcome to In-Sight(R) 4001 Session
1\r\nUser:"

then I put in:

tn.write("admin\r\n")
or
tn.write(USER + "\r\n")
or
tn.write(USER + "\r")
or
tn.write(USER + "\n")

Ive tried every combination I can think of but after that when I put in
tn.read_all() I get back ",,," and if I do any type of tn.read_until - it
gives me the traceback error.  thanks again for all your input.  really
appreciate.

Chris


On Mon, Feb 25, 2013 at 11:24 AM, square.steve <square.steve@gmail.com>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.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
>

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


Thread

Re: telnet to Cognex In-Sight 4001 camera Chris Annin <chris.annin@gmail.com> - 2013-02-25 12:27 -0800

csiph-web