Menu

%f problem. Bad argument type

Help
Anonymous
2002-09-05
2012-09-19
  • Anonymous

    Anonymous - 2002-09-05

    Hi all,

    When I try to do something like:

    c.execute("""SELECT id FROM orders WHERE price=%f""", (price)) on a table with a field named price (which is a float type field) it returns ...

    TypeError; bad argument type for built-in operation

    On the traceback it gives the error to line 66 of cursors.py

    OS: w2000
    mysqldb version:0.9.1final
    python: 2.2

    Any help?

    TIA

    Vicente (Teten)

     
    • Andy Dustman

      Andy Dustman - 2002-09-05

      Always use %s regardless of data type.

       

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.