Expect on window (from python script)

Cameron Laird claird at lairds.com
Mon Mar 3 17:32:12 CET 2003


In article <af24fc01.0303030717.263fe91a at posting.google.com>,
erez <erez at actona.com> wrote:
>claird at lairds.com (Cameron Laird) wrote in message
>news:<v641f94kcvsq99 at corp.supernews.com>...
>> In article <af24fc01.0303020124.343d341f at posting.google.com>,
>> erez <erez at actona.com> wrote:
>> >Hi,
>> >when i try to run python-script (on linux device) that uses pexpect
>> >module, and try to telnet window device, i can't do so ( the sendline
>> >function send only the first cur at a time )
>> >does someone know how could i interact window telnet ??? by expect
>> >
>> >Thanks, Erez
>> 
>> Let's be clear on our terms.  From the Linux command-line,
>> can you telnet to the Windows host, and "manually" drive
>> the Windows process to achieve the result you're after?  
>> Is that indeed a correct model for what you're after?
>> Briefly, can you get what you're after withOUT Python?
>> 
>> Even if you say, "No", it might still be possible to achieve
>> what you're after with Python.  All that answer would mean
>> is that I don't yet understand your requirements.
>To be more specific:
>i try to automate telnet process on window device, using the pexpect
>module,
>The action can be done by hand (telnet my_window_device) using windows
>-telnet-
>server, (from a command line from some Unix)
>for my understanding the Expect (like) module should works for windows
>device , (when i contact the windows device), it is working via Perl
>Expect (TCL too), i want to do so by Python.
>
>Jeff (Hi), what is it xmlrpc/Pyro can it help me ???  
>
>Thanks again, Erez

I smell an instance of what I call "the agent problem" 
somewhere in here.  More on that, later, perhaps.

Where can you find out about xmlrpc/Pyro?  Ah; this is
a thread in which no one has yet recommended a book.
I'll rectify that:  you probably want to read <URL:
http://www.unixreview.com/documents/s=7750/uni1041364857773/ >,
and perhaps <URL: http://www.python.org/cgi-bin/moinmoin/Pyro >.

In the meantime, you've supplied crucial information:  
you have enabled your Windows hosts' telnet servers.
Yes, you're right, you have reason to expect that your
pexpect coding should give you the results you're after.

You wrote me that
              child = pexpect.spawn('telnet xp-1')
              exp = child.expect('login: ')
              # till here all o.k
              child.sendline('tester')
              # Here start the problem :
              # the expect got only the first
              # cur from the word "tester"
              # instead of sending the whole
              # word and wait for the xp-1:password: line.
I don't understand this description.  Perhaps Noah will
check in to help.
-- 

Cameron Laird <Cameron at Lairds.com>
Business:  http://www.Phaseit.net
Personal:  http://phaseit.net/claird/home.html




More information about the Python-list mailing list