try: finally: question
peter at engcorp.com
Tue Jul 6 19:44:40 CEST 2004
> I have a question regarding the "proper" use of try: finally:... Consider
> some code like this:
> When I run this code, and an Error is raised, I get traceback (which I don't
> want) and the program terminates (which I don't want).
I'm sorry if I misinterpret what you want, but it sounds like you
need nothing more than an enclosing try/except.
d = Device.open()
raise Error # Error is subclass of Exception
... lots of other methods on d that can raise Error
# whatever you want here
Is anything wrong with that?
More information about the Python-list