Problem with format string / MySQL cursor
Florian Lindner
Florian.Lindner at xgm.de
Thu Oct 18 14:32:28 EDT 2007
Hello,
I have a string:
INSERT INTO mailboxes (`name`, `login`, `home`, `maildir`, `uid`,
`gid`, `password`) VALUES (%s, %s, %s, %s, %i, %i, %s)
that is passed to a MySQL cursor from MySQLdb:
ret = cursor.execute(sql, paras)
paras is:
('flindner', 'test1 at florian-lindner.de', '/home/flindner/', '/home/
flindner/Mail/test', 1001, 1001, '123')
But that gives me an error:
Traceback (most recent call last):
File "account.py", line 188, in ?
main()
File "account.py", line 33, in main
execute(action, account_type, options)
File "account.py", line 129, in execute
executeSQL(sql, options.username, options.login, options.home,
options.directory, options.uid, options.gid, options.password)
File "/home/flindner/common.py", line 29, in executeSQL
ret = cursor.execute(sql, paras)
File "/usr/lib/python2.4/site-packages/MySQLdb/cursors.py", line
148, in execute
query = query % db.literal(args)
TypeError: int argument required
I don't see errors in the format string or some other problem....
What's wrong?
Thanks,
Florian
More information about the Python-list
mailing list