[FRPythoneers] popen

Cary Miller Cary.Miller at uchsc.edu
Tue Jun 17 17:15:28 MDT 2003


You guys are so cool!!!  Thanks for the help.  One note that I should have 
mentioned before. The ^D really was a ^D.  This works in vim and seems to 
work in interactive python.  To get a control character you type Ctrl-V 
Ctrl-D(or whatever).

On Tue, 17 Jun 2003, Rob Riggs wrote:

> http://www.python.org/doc/current/lib/popen2-flow-control.html
> 
> You need to ch.tochild.close() before you ch.fromchild.read().
> 
> Cary Miller wrote:
> 
> >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?
> >
> >  
> >
> 
> 
> _______________________________________________
> This message sent by the FRPythoneers mailing list.
> Unsubscribe: echo unsubscribe | FRPythoneers-request at lists.community.tummy.com
> URL: http://lists.community.tummy.com/mailman/listinfo/frpythoneers
> 

-- 
//=\ 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