[geeks] Using Python3 to Telnet to OpenVMS
Sandwich Maker
adh at an.bradford.ma.us
Fri Apr 12 06:21:28 CDT 2013
" From: Mark Benson <md.benson at gmail.com>
"
" I am wondering if there are any seasoned Python3 and or OpenVMS hackers out
" there can help me.
"
" I am trying to build an automation interface to use telnet to connect, run
" a command, return the terminal output, then close the connection.
"
" Thus far I have:
"
" #required libs
" import getpass
" import telnetlib
"
" #connection spec
" HOST = "localhost"
" port = 3900
"
" #make connection
" tn = telnetlib.Telnet(HOST,port)
"
" #DZV11 requires a CR to start login process, so send one
" tn.write(b"\n")
"
" #wait for the Username: prompt
" tn.read_until(b"Username: ")
"
" #get a username from the user
" user = input("Enter your remote account: ")
"
" []
"
"
"
" Which should, by rights, do something. Thus far it doesn't work, it never
" even detects the 'Username: ' string.
" []
are you sure that *one* \n is enough to wake telnet up? i always give
it a few when i'm telnetting manually...
________________________________________________________________________
Andrew Hay the genius nature
internet rambler is to see what all have seen
adh at an.bradford.ma.us and think what none thought
More information about the geeks
mailing list