Re: "ProgrammingError: can't adapt" when passing arguments to cursor.execute

Adrian Klaver <[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <[email protected]>
On Friday 20 November 2009 7:55:16 am William Carithers wrote:
> Hi Tim,
>
> Thanks for the suggestions. I don't think that Python versions are the
> problem because when I first ran the script, it couldn't import psycopg2.
> Then I remembered that I had upgraded to Mac OS 10.6 (aka Snow Leopard)
> which ships with Python 2.6 since I last worked with psycopg2. Sure enough,
> my old psycopg was in site-packages for Python 2.5. So I installed the
> latest psycopg2 on Python2.6 and the script was happy to import. For the
> interactive session, the Python version comes up automatically and it was
> 2.6.
>
> Unfortunately changing load from a list to a tuple didn't solve the
> problem: Traceback (most recent call last):
>   File "./loadDB.py", line 117, in <module>
>     sys.exit(main())
>   File "./loadDB.py", line 87, in main
>     curs.execute(query, tuple(load))
> psycopg2.ProgrammingError: can't adapt
>
> Same thing with changing load = (...) instead of load[...]
>
> Thanks again,
> Bill
>

The 'can't adapt' part would seem to me to indicate a data type problem that the 
psycopg adapters can not handle. Hence my previous post about investigating why 
the float values where different in the two examples you showed.


-- 
Adrian Klaver
[email protected]
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.