title: how to catch specific pyodbc error message
body: <p>I trid the following code,</p>
  
  <pre><code>import pyodbc
  try:
      pyodbc.connect('DRIVER={%s};SERVER=%s;DATABASE=%s;UID=%s;PWD=%s' % (driver, server, database, uid, password))
  except pyodbc.Error, err:
      logging.warn(err)
  </code></pre>
  
  <p>The error message format i get is </p>
  
  <pre><code>('HY000', "[HY000] [MySQL][ODBC 5.1 Driver]Access denied for user 'root'@'192.168.2.27' (using password: YES) (1045) (SQLDriverConnect)")
  </code></pre>
  
  <p>I want to receive just the message part of the error i.e.</p>
  
  <pre><code>Access denied for user 'root'@'192.168.2.27'(using password: YES)
  </code></pre>
  
  <p>I dont know if I can catch errors specifically like, driver not found, host down etc..</p>
  
  <p>I also tried catching errors as:</p>
  
  <pre><code> except pyodbc.OperationalError, err:
      logging.warn(err)
  except pyodbc.DataError, err:
      logging.warn(err)
  except pyodbc.IntegrityError, err:
      logging.warn(err)
  except pyodbc.ProgrammingError, err:
      logging.warn(err)
  except pyodbc.NotSupportedError, err:
      logging.warn(err)
  except pyodbc.DatabaseError, err:
      logging.warn(err)
  except pyodbc.Error, err:
      logging.warn(err)
  </code></pre>
  
  <p>but the last one always catches the error.</p>
  
  <p>Fruthermore i saw the <strong>pyodbc.Error.message</strong> is always empty.
  How can i get just the message in the error.</p>
  
  <p>Thanks</p>