exceptions

Peter Hansen peter at engcorp.com
Mon May 31 19:57:15 EDT 2004


Zunbeltz Izaola wrote:

> Peter Hansen <peter at engcorp.com> writes:
>>Zunbeltz Izaola wrote:
>>>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.
> 
> But what I'm doing is not unittest. 

Pardon: I don't know why I thought this was related to testing
code.

> My program is controling and instrument (an x-ray powder
> diffractometer) and some parts of the instrument are not working for
> the moment, so i want to disable all error i get from this instrument
> (are coded like exceptions)

What is the interface to the instrument?  Is there some sort of
driver/wrapper layer that handles the communication with the
device?  Your only hope, I think, is to intercept things at
that level and avoid/trap the exceptions before they get up
to the higher level.  In effect, stubs as Irmen suggested...

It sounds like you are quite capable of figuring it out at
this point, though, since all you wanted to know was whether
you could continue after an exception and now you know you
cannot. :-)

-Peter



More information about the Python-list mailing list