def get_connect(self):
if self.db_lock.acquire():
try:
self.conn = MySQLdb.Connection(
host=self.host, user=self.user, passwd=self.passwd, charset=self.charset)
except MySQLdb.Error, e:
print str(datetime.datetime.now()).split(".")[0], "ERROR %d: %s" % (e.args[0], e.args[1])
self.cursor = self.conn.cursor()
if not self.cursor:
raise(NameError, "Connect failure")
self.db_lock.release()
# ?????
评论列表
文章目录