python telnet script for openvms host

Cameron Laird claird at
Tue Dec 26 20:17:48 CET 2000

In article <92apa7$oac$1 at>,
Ennis Rosamond  <ennisr at> wrote:
>In article <kuito7rrg7.fsf at>,
>  Erno Kuusela <erno-news at> wrote:
>> Ennis Rosamond <ennisr at> writes:
>> | tn.read_until('[c')    #last char of session hearder
>> | tn.write('$ dir\r')
>> | #following this, I receive back the sequence:
>> | #recv '\377\373\001'
>> | #IAC WILL 251
>> | #recv '\377\373\003'
>> | #IAC WILL 251
>> | #recv '\003\\\033Z'
>> | #
>> | #which I don't know how to interpret.
>> that looks like telnet option negotiation, telnetlib should
>> take care of all that automaticalyl for you. i suspect
>> the above is just some debug output from telnetlib.
>> are you sure you are seeing it after your last .write call,
>> and not at the start of the telnet connection?
>You are correct.  The sequence I listed is the debug output.  I am
>seeing it after the "tn.write('$ dir\r')" call.  It may not be relevant
>if the host simply isn't ready to receive the write call.
>I tried using "tn.read_until('$ ')" in the previous read instead of
>"tn.read_until('[c')", but that sequence is never found.  That is why I
>think the host is not sending back a prompt.  But then I am pretty naive
>about this whole topic.
1.  OpenVMS term negotiation is hairy--or at least
    I always forget the magic after about a year,
    and also where I put the answer the last time.
    Based on my experience, I'd guess it *very*
    likely that all your difficulties have to do
    with that initial negotiation.
2.  This kind of automation is a great idea.  You'll
    be plenty happy once you get it working.

Cameron Laird <claird at>

More information about the Python-list mailing list