exceptions

Peter Hansen peter at engcorp.com
Mon May 31 09:24:19 EDT 2004


Zunbeltz Izaola wrote:
> Peter Hansen <peter at engcorp.com> writes:
>>Zunbeltz Izaola wrote:
>>
>>>I've the following problem with try/exception.
>>>I've a try block that will raise some exceptions.
>>>I want the program to ignore this exceptions completely. Is it
>>>possible?
>>
>>In the following, all exceptions will be ignored:
>>
>>try:
>>      # something that raises exceptions
>>except:
>>     pass
> 
> I've trid this, but the problem is that this finished the try block.
> I want to continue executing the try block from the point the
> exception was raised.

Not possible except, perhaps, with a significant amount of
working involving sys.settrace().  I think you need to find
another way to solve the problem.

What you are trying to do is not something that other people
who do unit testing seem to have to do.  Why do you think
you need to actually *disable* exceptions entirely in order
to test this code?  Perhaps the code needs to be restructured?

-Peter



More information about the Python-list mailing list