Exceptions in the xrc mechanism

Hi, list,

When using the xrc mechanism to load custom Frames, Dialogs, Widgets,
etc, it seems that any exception that is encountered in the
initialization will be silently 'swallowed up' by the xrc mechanism,
so I can get the exact error information.

Is there a way to tell the xrc methods, like LoadFrame, to reraise the
exceptions or in any other way to print the exact traceback?

Best Regards,

···

--
Hong Yuan

大管家网上建材超市
装修装潢建材一站式购物
http://www.homemaster.cn

Hi,

XRC error checking is done in C++ so it can't raise Python exceptions.
wxLogError function is used to signal errors. You can redirect logging
before creating resources using wx.LogBuffer or deriving from wx.PyLog
and doing "oldLog = wx.Log.SetActiveTarget(newLog)". Then you can check
if any error messages were sent during the call to LoadFrame. You can
restore normal GUI logging by calling SetActiveTarget(oldLog).

Why do you need to catch those errors anyway? In most cases all
resources can be tested before running the application.

Hope this helps,

Roman

···

On Mon, 2007-06-18 at 11:37 +0800, Yuan HOng wrote:

Hi, list,

When using the xrc mechanism to load custom Frames, Dialogs, Widgets,
etc, it seems that any exception that is encountered in the
initialization will be silently 'swallowed up' by the xrc mechanism,
so I can get the exact error information.

Is there a way to tell the xrc methods, like LoadFrame, to reraise the
exceptions or in any other way to print the exact traceback?

Best Regards,