title: Python Program is Terminating on Handled Exception
body: <p>I am editing the question for clarity.</p>
  
  <p>I created a class in a module that imports MySQLdb. I have found that MySQLdb will raise an Exception if the table the user passes to my class does not exist. I am catching that exception, and passing a new one to the client. But even if the client catches my exception, the program still terminates. I have also tried passing to the client the same Exception MySQLdb is giving my  class.</p>
  
  <p>Since the client will be calling my method in a loop, passing in various table names, I don't want the program to choke if the table name is bad. I'd like the client's iterations to continue to the next valid table name. Here is a snippet (tableName is an arg pass in to the method):</p>
  
  <p>In my class/module: </p>
  
  <pre>
      self.tableName = tableName
      try:       
          self.cursor.execute("select * from " + self.tableName + ";") #Will raise Exception if the table does not exist.
      except:
          raise MyException("\n*** " + self.tableName + " does not exist. ***")
  </pre>
  
  <p>In the client:</p>
  
  <pre>
      tables = ["BadTableName", "GoodTableNameA", "GoodTableNameB","GoodTableNameC"]
  
      try:
          for table in tables:
              my_method(table) #Exception message gets passed in with BadTableName, but the program ends. Subsequest iterations of this loop never happen
      except Exception, e:
          print e
  
  </pre>
  
  <p>I would like the client to continue even after calling my_method(BadTableName).</p>
  
  <p>By the way, my_method() is part of a class defined in its own module which the client is importing.</p>
  
  <p>Thank you.</p>