Trapping the segfault of a subprocess.Popen
pierregmcode at gmail.com
Thu Apr 7 10:45:57 CEST 2011
On Apr 7, 5:12 am, Terry Reedy <tjre... at udel.edu> wrote:
> On 4/6/2011 7:58 PM, Nobody wrote:
> > On Wed, 06 Apr 2011 02:20:22 -0700, Pierre GM wrote:
> >> I need to run a third-party binary from a python script and retrieve
> >> its output (and its error messages). I use something like
> >>>>> process = subprocess.Popen(options, stdout=subprocess.PIPE,
> >> stderr=subprocess.PIPE)
> >>>>> (info_out, info_err) = process.communicate()
> >> That works fine, except that the third-party binary in question doesn't
> >> behave very nicely and tend to segfaults without returning any error. In
> >> that case, `process.communicate` hangs for ever.
> I am not sure this will help you now, but....
> Victor Stinner has added a new module to Python 3.3 that tries to catch
> segfaults and other fatal signals and produce a traceback before Python
Unfortunately, I'm limited to Python 2.5.x for this project. But good
to know, thanks...
More information about the Python-list