一旦我执行.getOne(),它就会卡住
from sqlobject import *
import threading
sqlhub.processConnection = connectionForURI('mysql://user:password@localhost:3306/database')
class Player(SQLObject):
name = StringCol(length=64)
last_login = DateTimeCol()
create_date = DateTimeCol(default=DateTimeCol.now)
def act():
result = Player.selectBy(name='Zippo')
player = result.getOne()
print 'You will never see this message in console.'
threading.Thread(target=act).start()发布于 2011-03-22 19:13:14
不幸的是,这个问题与SQLObject或Python无关。可能是我的电脑或者我的MySQL服务器。很抱歉问错了每个人。
发布于 2011-03-22 02:40:35
有没有可能getOne正在崩溃,而你只是没有看到异常?在这种情况下,您可以将默认结果指定为参数,也可以将其放入try/except子句中。
如果在调试器中运行它会发生什么?
这里没有太多的信息,因为我们不知道你的数据库中有什么。
https://stackoverflow.com/questions/5361943
复制相似问题