[FRPythoneers] popen

Cary Miller Cary.Miller at uchsc.edu
Tue Jun 17 16:43:25 MDT 2003

Hello pythoneers,
   My ultimate goal is to run an ssh session programatically.  So I want 
to open a pipe and read/write from/to it.  I can write but when I read 
the session hangs.  Here is an example using cat instead of ssh.

>>> ch = popen2.Popen4('cat')
>>> ch.tochild.write ('hello')
>>> ch.tochild.write ('goodbye\n')
>>> ch.tochild.write ('farewell\n')
>>> ch.tochild.write ('^D')
>>> ch.fromchild.read()
Hangs forever here.

It must be something very simple but I am stumped.  What am I missing?

//=\ Cary Miller                                    //=\  
\=// Center for Computational Pharmacology          \=// 
//=\ University of Colorado Health Sciences Center  //=\  
\=// http://compbio.uchsc.edu/Hunter_lab/Miller     \=// 
//=\ (303) 315-1584                                 //=\  

More information about the FRPythoneers mailing list