Sorry that i had't show my code clearly.
   The exception try and catch at the module function (i.e.
myClass.myfunction(), which like:

 #### start code within myClass.py ####
def myfunction(self, dbconnection):
  sql_query= 'update table set col=value'
  try:
    dbconnection.query(sql_query)
    result = dbconnection.store_result()
    tuple_list = result.fetch_row(0,0)
  except MySQLError (errno, strerror):
    print "MySQLError, errno: %s, strerror: %s" % (errno, strerror)
    return 11
  except (errno, strerror): # catch all
    print "General Error, errno: %s, strerror: %s" % (errno, strerror)"
    return 21
 #### end code within myClass.py ####

  and let main thread function (thread_function()) to handle the sub
thread function by its return value (mainly are update database,
printing message and continuous to run).

   Should the exception catch at main thread  function rather than
class function?
    Thank for helping.

   return 1

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to