Trapping the segfault of a subprocess.Popen

Terry Reedy tjreedy at udel.edu
Wed Apr 6 23:12:40 EDT 2011


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 
disappears.

-- 
Terry Jan Reedy




More information about the Python-list mailing list