解决MySQLdb导入时报出“不推荐继续使用的Sets模块”的问题
问题暴露:
客户端第一次访问时,总会卡上1——2s才能获得数据,之后再访问时就没有问题了。
?
问题解决:
在eclipse的django shell模式下测试服务端写的一些接口,在调用需要从数据库查询数据的方法时, 也出现了卡了1——2s的情况,然后提示:
the sets module is deprecated
?
这才意识到,是这个在python2.6中不推荐使用的sets模块导致了问题。
经过查询python2.6的手册:
?
from sets import ImmutableSetclass DBAPISet(ImmutableSet): """A special type of set for which A == x is true if A is a DBAPISet and x is a member of that set."""
? 改为:
?
# from sets import ImmutableSetclass DBAPISet(frozenset): """A special type of set for which A == x is true if A is a DBAPISet and x is a member of that set."""?
?
问题解决。