What Can Lead To “IOError: [Errno 9] Bad File Descriptor” During Os.System()?
I'm using os.system(), which is a scientific software including a python script, used to run another scientific program. There's a subprocess, which will be running and python will print the following:
close failed in file object destructor:
IOError: [Errno 9] Bad file descriptor
Even this message will be printed at the same time as os.system()?
But my question is, Which condition will lead to this type of IOError? What is it?
You can get this oserror errno 9 bad file descriptor if you use wrong mode when opening the file. For example:
with open(output, 'wb') as output_file:
In that code, I want to read the file, but I use mode wb instead of r or r+