I trid the following code,
import pyodbc try: pyodbc.connect(\'DRIVER={%s};SERVER=%s;DATABASE=%s;UID=%s;PWD=%s\' % (driver, server, database, uid, passwo
In pyodbc 3.0.7, it works fine to catch pyodbc.ProgrammingError (and presumably the other error types, although I haven't tried). The contents of the error are still sort of cryptic, though, so it may be hard to do finer-grained handling of errors.