Is there a limit to os.popen()?

Steve Holden steve at holdenweb.com
Wed Jul 12 03:49:59 EDT 2006


Carl J. Van Arsdall wrote:
> I'm not sure the proper way to phrase the question, but let me try.
> 
> Basically, I'm working with a script where someone wrote:
> 
> kr = string.strip(os.popen('make kernelrelease').read())
> 
> 
> And then searches kr to match a regular expression.
> 
> This seems to have been working, however lately when this line executes 
> I get a number of messages to stderr after several minutes of execution:
> 
> cat: write error: Broken pipe
> cat: write error: Broken pipe
> cat: write error: Broken pipe
> 
> 
> I know the output from this make has been growing (make applies some 
> patches and the patch list is growing).  Does os.popen() have some kind 
> of read buffer limit that i'm hitting which is causing things to break?
> 
> 
> 
> 
While I can't tell you where the error is, I *can* tell you that the 
message is caused when some proces that's writing to a pipe sees the 
pipeline's reader close the pipe while the writer is still sending data.

If you are seeing alot of error messages you shoudl really redirect the 
standard error to a file to avoid them cluttering up your console.

regards
  Steve
-- 
Steve Holden       +44 150 684 7255  +1 800 494 3119
Holden Web LLC/Ltd          http://www.holdenweb.com
Skype: holdenweb       http://holdenweb.blogspot.com
Recent Ramblings     http://del.icio.us/steve.holden




More information about the Python-list mailing list