[Zope] Intercept exceptions in Python Methods

Juan Carlos Coruņa jcoruna@umd.es
Mon, 8 Jan 2001 18:54:39 +0100


I try to intercept exceptions in a Python Method without success.

The following code works well:

try:
    a = int('a')
except:
    return 'exception.'

but the next doesn't work:

try:
    a = int('a')
except ValueError:
    return 'exception'

How can I intercept a concrete exception?