problems with mysql db

Lawrence D'Oliveiro ldo at geek-central.gen.new_zealand
Tue Jun 30 04:05:26 CEST 2009

In message <mailman.2303.1246287643.8015.python-list at>, Gabriel 
Genellina wrote:

> The fact that it's the same character used for formatting strings with the
> % operator is an unfortunate coincidence (or a very bad choice, I don't
> know).

That's not the problem. The problem is that MySQLdb IS indeed using Python 
format substitution to do its argument substitution. Python expects the 
value for "%d" to be an integer. But MySQLdb has already converted all the 
argument values to strings. Hence the error.

If MySQLdb were doing its own parsing of the format string, it could produce 
a more meaningful error message when it sees "%d" (e.g. "only %s 
substitutions allowed").

More information about the Python-list mailing list