Exception and finally question

Erik Max Francis max at alcyone.com
Fri Apr 25 22:03:56 EDT 2003


Bengt Richter wrote:

> Hm, how would you catch all exceptions raised as strings (e.g., raise
> "ho", "hum")
> and print both string and 2nd arg? Do I have to dig with inspect?
> It might be convenient if the system would convert such exceptions to
> a standard one,
> so we could write e.g.,
>     except  OldStringException, e:
>         print e, e.args
> and see the particular string and also a message arg.

The way I handled them in EmPy was to do an except Exception, e: ... and
if that got passed up, do an except: e = sys.exc_type.

-- 
 Erik Max Francis / max at alcyone.com / http://www.alcyone.com/max/
 __ San Jose, CA, USA / 37 20 N 121 53 W / &tSftDotIotE
/  \ I am a gentlemen:  I live by robbing the poor.
\__/ George Bernard Shaw
    Bosskey.net: Return to Wolfenstein / http://www.bosskey.net/rtcw/
 A personal guide to Return to Castle Wolfenstein.




More information about the Python-list mailing list