在Python库中捕获段错误 [英] Catching a segfault in a Python library
问题描述
哟,
我的应用程序依赖于PIL。当PIL遇到某个问题字体时(对于
目前未知的原因),它往往会出现段错误,并且没有任何尝试/除了
将使我的wxPython应用程序保持活动状态。
我的第一个想法是从bash脚本启动应用程序,它将检查我的wxPython应用程序的
返回值,然后可以启动一个新应用程序来帮助
用户了解发生了什么并修复它。
你认为这是个好主意,还是有另一种处理方式的方法>
喜欢这个? (也许是一个Python应用程序启动另一个Python应用程序?)
/ d
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 ******** @ gmail.comwrites:
Donn Ingle <do********@gmail.comwrites:
你认为这是个好主意,还是有另一种方法可以处理东西
喜欢这个? (也许是一个Python应用程序启动另一个Python应用程序?)
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.
在调试器下运行你的应用程序并找出导致它崩溃的原因。
已经完成,PIL中的代码导致崩溃。它变得很丑陋而且我的职权范围是b $ b。这是一个freetype / Pil的东西,我只是想在它发生的时候找到它的方式。
由于段错误结束了这个过程,我问的是;包装"围绕代码
来抓住段错误。
\ n
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< do ******** @ gmail.comwrites:
Donn Ingle <do********@gmail.comwrites:
在调试器下运行你的应用程序并弄清楚是什么让它崩溃。
Run your app under a debugger and figure out what is making it crash.
已经完成,PIL中的代码导致崩溃。它变得很丑陋而且我的职权范围是b $ b。这是一个freetype / Pil的东西,我只是想在它发生的时候找到它的方式。
由于段错误结束了这个过程,我问的是;包装"围绕代码
来抓住段错误。
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.
我认为你应该实际调试它,或者至少重现它
并向PIL人员发送错误报告,但无论如何您可以使用
os.wait()来获取退出状态并识别seg故障。
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.
这篇关于在Python库中捕获段错误的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!