Exceptions

You can try with the following code in the call to App.MainLoop() (and in my applications it works):

···

2008/3/10, Mark Erbaugh mark@microenh.com:

Is there a place / way to trap unhandled exceptions in a wxPython
application. At first I thought that I could put the call to
App.MainLoop() inside a try: except: block and catch the exception
there, but it seems that unhandled exceptions raised in my code never

make it there.

My program uses psycopg to access a PostgreSQL database and if an
unexpected database error occurs, I’d like my program to display a
message with the error information from psycopg and exit. I’m already

handling recoverable errors (integrity violations, etc).

For example, one error that I want to abort from would be permission
problems. If somehow the user doesn’t have the appropriate permissions
for an operation, I want to display the error so that someone can go

into Postgres and adjust permissions.

Thanks,
Mark


To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org

For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org