Re: telnet to Cognex In-Sight 4001 camera

Discussion in 'Python' started by Chris Annin, Feb 25, 2013.

  1. Chris Annin

    Chris Annin Guest

    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 <>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:
    > Date:
    > To:
    > 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:
    [color=green][color=darkred]
    > >>>import sys
    > >>>import telnetlib
    > >>>HOST = "10.31.18.21"
    > >>>USER = "admin"
    > >>>tn = telnetlib.Telnet(HOST)
    > >>>tn.read_until("Login: ")[/color][/color]
    > "Welcome to In-Sight(R) 4001 Session 1\r\nUser:"[color=green][color=darkred]
    > >>>tn.write(USER + "\r\n")
    > >>>tn.read_until("User: ")[/color][/color]
    > 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[color=green][color=darkred]
    > >>>[/color][/color]
    > [\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
    >[/color]
     
    Chris Annin, Feb 25, 2013
    #1
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Newbie
    Replies:
    6
    Views:
    498
    The Artist Formerly Known as Kap'n Salty
    Feb 2, 2005
  2. Carcarius
    Replies:
    0
    Views:
    322
    Carcarius
    Dec 6, 2007
  3. Replies:
    5
    Views:
    498
    Roy Smith
    Feb 26, 2013
  4. Replies:
    0
    Views:
    126
  5. MRAB
    Replies:
    2
    Views:
    126
Loading...

Share This Page