def retCursor():
host = "localhost"
user = "disappearedng"
db = "gupan_crawling3"
conn = MySQLdb.connect( host=host, user=user, passwd=passwd, db=db)
cursor = conn.cursor()
return cursor
singleCur = retCursor()
def checkTemplateBuilt(netlocH):
"""Used by crawler specifically, this check directly whether template has been built"""
singleCur.execute( """SELECT templateBuilt FROM templateEnough WHERE netloc=%s""", [ netlocH])
r = singleCur.fetchone()
if r:
if bool( r[0]):
return True
return False
大家好,我正在使用MySQLdb。不知为什么,在运行了30分钟后,我的应用程序就完全停止了。看来这个功能正在阻止我。(不知道是什么原因)
^{pr2}$顺便说一句,这是表格:
CREATE TABLE templateEnough(
`netloc` INT(32) unsigned NOT NULL,
`count` SMALLINT(32) unsigned NOT NULL,
`templateBuilt` TINYINT(1) unsigned DEFAULT 0 NOT NULL,
PRIMARY KEY ( netloc )
) ENGINE=MEMORY DEFAULT CHARSET=utf8
;
有什么想法吗?在
请尝试在执行查询字符串之前将其记录到文件中。 然后,当您认为它是挂起的,您可以查看查询,看看它是否可以手动工作
表上可能有一个锁阻止查询完成。在
根据您的回溯,您在执行}时中断了脚本。在
checkTemplateBuilt
,而不是{我认为问题出在代码的另一部分;也许在某个地方有一个无限循环?可能在
run
函数中?在相关问题 更多 >
编程相关推荐