2006年11月03日 星期五 17:18
我在连Mysql时,用了下面的语句:
mydb=MySQLdb.connect(host='localhost',db=text1,user=text2,passwd=text3,use_unicode=1, charset='utf8')
mycursor=mydb.cursor()
但是系统却报出:
Unhandled exception of type exceptions.TypeError occured at 16:48:51:
Traceback:
File: orngSignalManager.py in line 60
Function name: __call__
Code: apply(self.method, k)
File: OWClassificationinDatabase.py in line 74
Function name: select
Code: mydb=MySQLdb.connect(host='localhost',db=text1,user=text2,passwd=text3,use_unicode=1, charset='utf8')
File: __init__.py in line 66
Function name: Connect
Code: return Connection(*args, **kwargs)
File: connections.py in line 134
Function name: __init__
Code: super(Connection, self).__init__(*args, **kwargs2)
Exception type: exceptions.TypeError
Exception value: 'charset' is an invalid keyword argument for this function
我在邮件列表中,看到好些高-大-侠都这么用,为什么到我这就不行了呢?
另:我把charset='utf8'改为charset='gb2312',因为我的mysql数据库被我设成
set names 'gb2312',但错误还是相同的.不知那位高手给解释一下.bow!
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://python.cn/pipermail/python-chinese/attachments/20061103/523d70fb/attachment.htm
Zeuux © 2025
京ICP备05028076号