close failed: [Errno 0] No error goes to stdout

Yoav yoav_artzi at
Tue Aug 30 15:03:35 CEST 2005

Steve Holden wrote:
> Yoav wrote:
>> I run a Java command line program. The point is, that it's not the 
>> program that output this error message for sure. And I don't expect 
>> popen3() to catch and report errors. I just want to keep my screen 
>> output clean, and I expect popen3() to run the program and not let 
>> anything slip to the screen, after all as I understood it is supposed 
>> to capture STDERR and STDOUT, but maybe I didn' t understand it right 
>> (it's quite probable). Anyway anyway I can do such a thing?
> It would be helpful if you could verify your theory by running the 
> program from the command line with standard AND error output 
> redirection, verifying that no output at all apears on the console when 
> you type
> cmd > /tmp/stdout 2>/tmp/stderr
> You are correct in supposing that popen3 is supposed to trap all stdout 
> and stderr output.
> regards
>  Steve

Thank you all for your help.
I managed to get rid of it, and I have this theory which I want to hear 
your opinion about it:
It seems like it happened because I didn't bother to close the files 
resulting from os.popen3(), and left Python to close them on it own. the 
STDERR file wasn't always created, and therefore when Python tried to 
close it, it generated an error. I thought that Python has better 
abilities at closing files on its own, but I guess I was wrong. So my 
conclusion is that whenever I open a file it MY job to close it. Again, 
thank you all, you have been a great help. So now I am closing it with a 
"try:... except: pass".



More information about the Python-list mailing list