Setting Exception data.
Ivan Munoz
imunoz at eso.org
Sat Mar 10 22:00:22 EST 2001
More information about the Python-list mailing list
Sat Mar 10 22:00:22 EST 2001
- Previous message (by thread): kbhit() and getch() question
- Next message (by thread): Setting Exception data.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
Hi,
I have a C extension module called 'foo' and I define an Exception class
for it foo.error.
When raising a foo.error exception In my C code I set the error object
to some data (an object defined on my extension module, an integer and a
string) as follows:
v=Py_BuildValue("Ois", e, errorNumber, errStr);
if (v != NULL) {
PyErr_SetObject(ErrorObject, v);
Py_DECREF(v);
}
so far so good, in Python then I catch this exception as:
except foo.error, (object, errnum, errstr):
.....
.....
Now what is the right way to acomplish the same from Python?, this does
not seem to work ....
raise foo.error MyObject, errnum, 'You are toasted'
thanx in advance,
IvO
- Previous message (by thread): kbhit() and getch() question
- Next message (by thread): Setting Exception data.
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list