[Tutor] How to manage stdin, stdout on Python NT ?

Ke-Hsiang Shao KShao@AstralPoint.com
Thu, 26 Aug 1999 19:20:40 -0400


Hi there,

In the win32 extension, there is win32pipe. In there, user can use
win32pipe.popen2 or popen3, popen4 to start a command/program and the stdin,
stdout will be in [0] ans [1] respectively.

The statements are like this.

p=win32pipe.popen2('extelnet admin2','t')
prompt=p[1].readlines()

...

when I found the "login:" returned, I issue

p[0].write('username\r\n')

and after that, the extelnet never response.


Where

   extelnet is a command line telnet.exe which I got from expect package.


I can manually run 'extelnet' and works fine. I can run tcl/expect works
fine on my NT environment.

My question is:

Does any one successfully drive telnet on win32 Python ? Is so, how does
he/she manage the stdin ? Any example works on win32 environment ?

Thanks


Cary Kehsiang   email:  Shao cary_shao@yahoo.com
Astral Point Communications, Inc.     kshao@astralpoint.com
27 Industrial Ave., Chelmsford, MA 01824
Phone: (978) 256-9984         Fax:     (978) 256-6128