这是我的代码
import sys
import logging
import traceback
import MySQLdb
def log_except_hook(*exc_info):
text = "".join(traceback.format_exception(*exc_info))
logging.error("Unhandled exception: %s", text)
sys.excepthook = log_except_hook
db = MySQLdb.connect("sdfgdfgsdgd.nl","1","1","1" )
cursor = db.cursor()