os.popen2 :URGENT

Dave Kuhlman dkuhlman at rexx.com
Tue May 27 16:20:16 EDT 2003


John Hunter wrote:

[snip]

> If you do want to have more control over the stdin and stdout of
the
> program you are controlling, use popen2, popen3.  Here is the
example
> above using popen2
> 
>     import os
>     sin, sout = os.popen2('./get_input.py')
>     sin.write('Hi\n')
>     sin.flush()
>     print sout.read(),

Do I need to close sin and sout in the above example?  If I have
long running code and I do the above over and over *without*
closing these file objects, will I eventually run out of file
handles or something?

  - Dave

-- 
Dave Kuhlman
http://www.rexx.com/~dkuhlman
dkuhlman at rexx.com





More information about the Python-list mailing list