NoneType object has no attribute 'cursor'
w564791 opened this issue · comments
def execute(self, *a, **kw):
cursor = kw.pop('cursor', None)
try:
cursor = cursor or self.get_conn().cursor()
cursor.execute(*a, **kw)
except (AttributeError, MySQLdb.OperationalError):
self.conn and self.conn.close()
self.conn = None
cursor = self.get_conn().cursor()
cursor.execute(*a, **kw)
return cursor
报错直接致命第71行,这里为什么又要连一次呢,上面不是已经捕获了错误了么,except里面再连一次,就捕获不到错误了啊