Exception handling....dumb question?

Rune Strand rune.strand at gmail.com
Fri Mar 31 19:06:45 EST 2006


kbperry wrote:
> In Python,
> When using the default except (like following)
>
> try:
>     some code that might blow up
>
> except:
>     print "some error message"
>
>
> Is there a way to show what error it is throwing?
>
> Like in Java, you can do
> catch (Exception e){
>     System.out.println(e);
> }
>
> Or something like that.
>
> Is there an equivalent way to do this in Python?

see sys.exc_info( )




More information about the Python-list mailing list