执行以下任务时出现此错误,
results = db1.executeSelectCommand(siteSql, (),) TypeError: unbound method executeSelectCommand() must be called with dbConnn instance as the first argument (得到 str 实例)
我的代码如下:
class dbConnn:
db_con = None
execfile("/Users/usera/Documents/workspace/testing/src/db/db_config.py")
def executeSelectCommand(self,sql,ip):
#psycopg connection here.
我在这里使用这个类:
from db import dbConnections
db1 = dbConnections.dbConnn
siteSql = 'select post_content from post_content_ss order by RANDOM() limit 500' #order by year,month ASC'
results = db1.executeSelectCommand(siteSql, (),)
在windows中,似乎没有这个问题?上帝,它一定很初级,但我找不到。