【发布时间】:2012-05-26 19:56:36
【问题描述】:
我正在尝试编写一组 Python 类,这些类将查询数据库以检索一些值,然后构建网络图。问题是每当我尝试为我的一个类调用构造函数时都会收到此错误 相关代码如下
class NetworkConstructor:
def __init__(self):
self.nodes=dict()
self.queryservice=QueryService()
self.graph=networkx.Graph()
QueryService 类的相关位是
def __init__(self):
self.connect()
def connect(self):
self.conn=MySQLdb.Connect(host="xxx", port=3306,user="xxx",passwd="xxx",db="xxx")
self.cursor=self.conn.cursor()
我还导入了所有必需的库
【问题讨论】:
-
哪一行导致了问题?
-
你能用整个堆栈跟踪更新问题吗? :) 另外,这个类是否在同一个文件中?
标签: python import module callable