Issue 1030388: os.system exhausts file descriptors (original) (raw)
this is a strange behavior that i could not make a concise test case for.
i wrote a simple script to run several hundreds of jobs consecutively using os.system() call. on some occasions, especially when I use CTRL-C to break all of them to get out of the script (I didn't handle any signals...), i couldn't run the script again. the system gave a 'too many files open on the system' on a linux 2.4 (debian) system.
suspecting that this might be due to os.system i wrote a simple run function that uses os.popen() instead. def run(cmd): a = os.popen(cmd) lines = a.readlines() return not a.close()
and the problem never occured again.
i can't tell why using os.system can cause that, i had never encountered this error on linux, to be honest.
Logged In: YES user_id=21627
This sounds like a bug in your C library, or an unrelated bug in the programs you start, or in your Python application. Python's os.system is just a thin wrapper around system(3).
So I'm closing this as third-party unless there is some stronger evidence that there actually is a problem with Python here.