[Tutor] os.popen
Danny Yoo
dyoo at hkn.eecs.berkeley.edu
Mon Nov 29 18:21:22 CET 2004
On Mon, 29 Nov 2004, Klas Marteleur wrote:
> hmm..
> Is it nesessary to close the "file objects"?
>
> a = os.popen3("tcextract -v")
> tcexVerOut= a[2].readlines()
> a[0].close() #Nesessary?
> a[1].close() #Nesessary?
> a[2].close() #Nesessary?
Hi Klas,
Almost certainly yes at some point, due to "flow-control" issues. It's
very possible that a command like tcextract will stall until its input
stream is closed.
For more information, see:
http://www.python.org/doc/lib/popen2-flow-control.html
Good luck to you!
More information about the Tutor
mailing list