title: How can python psycopg2 ignore some internal error when commit many queries
body: <p>I got some trouble when using python psycopg2 commit some queries, below is my code:</p>
  
  <pre><code>db = psycopg2.connect(database="**", user="**", password="**", host="**", port="**")
  cursor = db.cursor()
  cursor.execute("***") # actually I have many cursor.execute()
  db.commit()
  </code></pre>
  
  <p>my problem is when commit so many queries, if it occurs some error within some of them, the whole commit program will dead, and how could I ignore these error and commit the rest of the queries?</p>
  
  <p>I have try to do something:</p>
  
  <pre><code>db = psycopg2.connect(database="**", user="**", password="**", host="**", port="**")
  cursor = db.cursor()
  cursor.execute("***") # many cursor.execute()
  for i in range(3):
      try:
          db.commit()
          break
      except Exception, e:
          db.rollback()
          log.write(traceback.format_exc() + "\n\n sql error: " + e.pgerror)
          time.sleep(1.5)
  </code></pre>
  
  <p>But it seems not work, can anyone help me?</p>