pyrex exceptions

Haris Bogdanovic haris at email.hinet.hr
Mon Apr 28 08:17:38 EDT 2003


How do I handle exceptions in Pyrex ?
I have a C++ wrapper around some C library and I'm doing a Python wrapper
around that library (copying C++ wrapper object model).
In C++ wrapper there is a class Exception which is derived from C++ standard
exception class.
In Pyrex it is not yet possible to derive an extension type from Python
class so I would have to create extension type for handling exceptions from
scratch.
If I want to raise an exception like this :
raise ExceptionClass(error)
how should then ExceptionClass be defined ?
I'm using wxPython GUI so I want to show the message box (window) which
displays error text when raising exception and then let user to choose from
options of ending or continuing the program from some previous place in code
or correcting error which caused the exception.

Can you please give me just the bare bones of how should that exception
class look like.(in Pyrex, as extension type)
I'm also little bit unfamiliar with what exactly goes on when program raises
an error with class instance as attribute. Could you explain that just in a
few words ?

Thank you
Haris






More information about the Python-list mailing list