By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
448,470 Members | 966 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 448,470 IT Pros & Developers. It's quick & easy.

cursor.executemany() float error

P: n/a
Data Struct:
from (string), to (string), rate (float)

when i run this:

cursor.executemany('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%f)', [ ('AA','BB',10.2), ('CC','DD',10.3) ] )

i got this error:
TypeError: float argument required

i checked, 10.2 & 10.3 , there are at the right loc.
what went wrong??

Dec 3 '06 #1
Share this Question
Share on Google+
2 Replies


P: n/a
progman wrote:
cursor.executemany('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%f)', [ ('AA','BB',10.2), ('CC','DD',10.3) ] )

i got this error:
TypeError: float argument required

i checked, 10.2 & 10.3 , there are at the right loc.
what went wrong??
posting a bit more of the traceback, and mentioning what database you're
using might be helpful.

have you tried using "%s" markers for all parameters, btw? (SQL data
binding and %-style string formatting are two different things, after all).

</F>

Dec 3 '06 #2

P: n/a
i am using mysql

i tried the
cursor.executemany('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%s)', [ ('AA','BB',10.2), ('CC','DD',10.3) ] )

and it works.

very strange. isn't it?????

Fredrik Lundh wrote:
progman wrote:
cursor.executemany('insert into promo (`From`,`To`, `RATE`) \
values (%s,%s,%f)', [ ('AA','BB',10.2), ('CC','DD',10.3) ] )

i got this error:
TypeError: float argument required

i checked, 10.2 & 10.3 , there are at the right loc.
what went wrong??

posting a bit more of the traceback, and mentioning what database you're
using might be helpful.

have you tried using "%s" markers for all parameters, btw? (SQL data
binding and %-style string formatting are two different things, after all).

</F>
Dec 3 '06 #3

This discussion thread is closed

Replies have been disabled for this discussion.