exceptions

Zunbeltz Izaola zunbeltz at wm.lc.ehu.es.XXX
Mon May 31 09:35:20 EDT 2004


Peter Hansen <peter at engcorp.com> writes:

> 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?

Possibly the code should be restructered, and re-designed; there is
always room for imporovement. But what I'm doing is not unittest. 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)

Zunbeltz
> 
> -Peter

-- 
Zunbeltz Izaola Azkona                    |  wmbizazz at lg dot ehu
dotes
Materia Kondentsatuaren Fisika Saila      |
Zientzia eta Teknologia Fakultatea        |  Phone: 34946015326
Euskal Herriko Unibertsitatea             |   
PK 644                                    |  Fax:   34 944648500
48080 Bilbo (SPAIN)                       |



More information about the Python-list mailing list