popen problem

Tim Peters tim.one at home.com
Mon Mar 12 07:25:02 CET 2001


[Marco Catunda]
> What's wrong with this code?
>
> ##########################
> import threading
> import os
>
> class TestPopen( threading.Thread ):
>
>    def run( self ):
>       while 1:
>          f = os.popen( "ls -l /" )
>          lines = f.read()
>          f.close()
>
> if __name__ == "__main__":
>    for i in range(50):
>       t = TestPopen()
>       t.start()
> ###########################
> [and it eventually dies w/ IOErrors in the f.close() calls]

You should report this as a bug on SourceForge, and make it very clear then
which version of Python you're using and under which operating system.  Best
guess is that your OS is simply running out of resources, but no way to tell
for sure based on what you've said here.





More information about the Python-list mailing list