abelikov72 at hotmail.com
Thu Jan 16 22:24:02 CET 2003
Some code I "exec" throws a TypeError exception. I want it to throw this
exception but want to be able to catch this along with the others which
are in fact being caught by the try/except block.
The specific TypeError in this case is caused by a module-defined
function being called with the incorrect number of arguments. Again,
I want to catch this exception. The problem is, this exception, unlike
the others, is not being caught/handled by my try/except block.
Can someone tell me why this is and perhaps how I can catch it?
for line, expecting in lines:
print '[%d] %s' % (i, line)
printerror('this should have thrown an exception')
print '\t '+repr(sys.exc_value.args)
printerror('this should not be an exception')
The structure of "lines" is :
lines = [
('foo = MyModule.Something()',1),
More information about the Python-list