At Wednesday 27/12/2006 17:13, tac-tics wrote:
For exceptions, I can simply use a catch-all except statement like:
try:
...
except Exception, error:
JOptionPane.showMessageDialog(self, "Error: %s" % error)
Normally, I could simply use a regular
except:
....
but then I don't have access to the error message.
Other people already said that all builtin exceptions are derived
from Exception. So using except Exception: xxx, you catch all of
them. What's left:
- string exceptions: deprecated long time ago, but you might
encounter them in old code.
- other classes not derived from Exception: still legal, probablly
not on future Python versions.
If you really have to catch any kind of exception, use a bare except
clause; you always can retrieve the exception details using
sys.exc_info()
--
Gabriel Genellina
Softlab SRL
__________________________________________________
Preguntá. Respondé. Descubrí.
Todo lo que querías saber, y lo que ni imaginabas,
está en Yahoo! Respuestas (Beta).
¡Probalo ya!
http://www.yahoo.com.ar/respuestas
--
http://mail.python.org/mailman/listinfo/python-list