thread end and make main program end also?

martinnitram at excite.com martinnitram at excite.com
Thu Mar 10 21:43:08 EST 2005


  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




More information about the Python-list mailing list