MySQL InterfaceError
kaens
apatheticagnostic at gmail.com
Wed Jun 6 19:50:39 EDT 2007
On 6/5/07, Joe <joe at incomps.com> wrote:
>
>
>
>
> >File "build/bdist.linux-i686/egg/MySQLdb/cursors.py", line
> 147, in execute
>
> > charset = db.character_set_name()
>
> >
>
> >InterfaceError: (0, '')
>
>
>
> We got it working. It was caused by passing a database connection to a
> module:
>
>
>
> import MySQLdb
>
> import module_name
>
> connection = MySQLdb.connect(host='localhost', user='user',
> passwd='password', db='database')
>
> module = module_name.ClassName(connection)
>
>
>
> But, when the connection was made within the module itself, it would work
> flawlessly every time. Can someone explain to me why this is?
>
>
>
> Jough
> --
> http://mail.python.org/mailman/listinfo/python-list
>
Try passing the cursor and not the connection -
import MySQLdb
import module_name
connection = MySQLdb.connect(host='localhost', user='user',
passwd='password', db='database')
cursor = connection.cursor()
module = module_name.ClassName(cursor)
You'll probably have to modify the module's code a bit as well, but it
should work.
More information about the Python-list
mailing list