MySQLdb: TypeError: not all arguments converted ...

Achim Domma domma at procoders.net
Tue Oct 14 05:31:08 EDT 2003


Hi,

I'm using MySQLdb with Python 2.3 on windows. Querying a database seems to
work fine, but inserting does not. If I try something like this:

cursor.execute("insert into Webpages (Url) values (?)", (url,))

I get the following Error:

  File "C:\Python23\Lib\site-packages\MySQLdb\cursors.py", line 95, in
execute
    return self._execute(query, args)
  File "C:\Python23\Lib\site-packages\MySQLdb\cursors.py", line 110, in
_execute
    self.errorhandler(self, TypeError, m)
  File "C:\Python23\Lib\site-packages\MySQLdb\connections.py", line 33, in
defaulterrorhandler
    raise errorclass, errorvalue
TypeError: not all arguments converted during string formatting

url is a unicode string. I tried to convert it via url.encode('utf-8') to a
string, but this does not help. Any hint what's going wrong?

regards,
Achim






More information about the Python-list mailing list