[Zope] Capturing SQL Method exceptions in Python scripts

Satheesh Babu vattekkat.babu@verizon.net
Wed, 11 Dec 2002 19:42:26 -0500


Hello,

I've a python script in which I would like to call some SQL methods. 
Some SQL methods in question are DDL statements (alter table etc.). What 
I'm trying to do is to make an installer script for some patches.

However, it is possible that the DDL statements might fail. How can I 
capture the exception type and process it?

the zope-error pages come up like "sql.error: blah blah blah"

try:
   ret = mysql()
except sql.error, details
   print ...

Normal python! But what should I REALLY use for sql.error ?

Thanks in advance

S Babu
http://vsbabu.org/