python段错误原因_在Python库中捕获段错误

Yo,

An app of mine relies on PIL. When PIL hits a certain problem font (for

unknown reasons as of now) it tends to segfault and no amount of try/except

will keep my wxPython app alive.

My first thought is to start the app from a bash script that will check the

return value of my wxPython app and could then launch a new app to help the

user grok what happened and fix it.

Do you think that''s a good idea, or is there another way to handle stuff

like this? (perhaps a Python app launching another Python app?)

/d

解决方案Donn Ingle

Do you think that''s a good idea, or is there another way to handle stuff

like this? (perhaps a Python app launching another Python app?)

Run your app under a debugger and figure out what is making it crash.

Run your app under a debugger and figure out what is making it crash.

Already done, the code within PIL is causing the crash. It gets ugly and out

of my remit. It''s a freetype/Pil thing and I simply want to a way to catch

it when it happens.

Since a segfault ends the process, I am asking about "wrappers" around code

to catch a segfault.

\d

Donn Ingle

Run your app under a debugger and figure out what is making it crash.

Already done, the code within PIL is causing the crash. It gets ugly and out

of my remit. It''s a freetype/Pil thing and I simply want to a way to catch

it when it happens.

Since a segfault ends the process, I am asking about "wrappers" around code

to catch a segfault.

Well I think you should actually debug it, or at least reproduce it

and send a bug report to the PIL folks, but anyway you can use

os.wait() to get the exit status and recognize the seg fault.

  • 0
    点赞
  • 1
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值