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

William Carithers <wccarithers-/[email protected]>
Newsgroups gmane.comp.python.db.psycopg.devel
Message-ID <C72C2D6D.10A94%[email protected]>
Hi Adiran,

I'm using psycopg2.0.13 and Python 2.6 in both script and interactive.
Here's the output from the debug print on psycopg2.__version__ and sys.path.
The curs.mogrify(query, load) failed in the same "can't adapt" way

2.0.13 (dt dec ext pq3)
['/Users/williamcarithers/BOSS/src',
'/Library/Python/2.6/site-packages/setuptools-0.6c9-py2.6.egg',
'/Library/Python/2.6/site-packages/ipython-0.10-py2.6.egg',
'/Library/Python/2.6/site-packages/psycopg2-2.0.13-py2.6-macosx-10.6-univers
al.egg', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python26.zip',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6',
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat
-darwin', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat
-mac', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/plat
-mac/lib-scriptpackages',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python'
, 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-
tk', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-
old', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/lib/python2.6/lib-
dynload', '/Users/williamcarithers/.local/lib/python2.6/site-packages',
'/Library/Python/2.6/site-packages',
'/Library/Python/2.6/site-packages/PIL',
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/
PyObjC', 
'/System/Library/Frameworks/Python.framework/Versions/2.6/Extras/lib/python/
wx-2.8-mac-unicode']
Traceback (most recent call last):
  File "./loadDB.py", line 120, in <module>
    sys.exit(main())
  File "./loadDB.py", line 88, in main
    print curs.mogrify(query, load)
psycopg2.ProgrammingError: can't adapt

Thanks,
Bill

On 11/20/09 10:16 AM, "Adrian Klaver" <[email protected]> wrote:

> 
> ----- "William Carithers" <wccarithers-/[email protected]> wrote:
> 
>> Hi Adrian,
>> 
>> Here it is:
>> quasar=# create table flags (
>>  plate integer,
>>  mjd integer,
>>  fiber integer,
>>  redshift real,
>>  class varchar(20),
>>  core boolean,
>>  bonus boolean,
>>  midz boolean,
>>  lohiz boolean,
>>  neural boolean,
>>  ukidds boolean,
>>  kde boolean,
>>  likely boolean,
>>  first boolean,
>>  umag real,
>>  gmag real,
>>  rmag real,
>>  imag real,
>>  zmag real,
>>  visual varchar(20));
>> CREATE TABLE
>> 
>> Thanks for your help,
>> Bill
>> 
>> 
> 
> I am CC'ing the list as the more eyes the better. I could not replicate your
> problem. When I ran your query via a script with the data provided it worked.
> This was with psycopg2 2.0.6 and 2.0.12 and Python 2.5 running on Ubuntu
> Hardy. You may want to sprinkle your script with some more debug information
> i.e sys.path and psycopg2.__version__ to make sure you are in fact using the
> module you think you are. I remember there have some issues with Snow Leopard
> and/or Python 2.6 because modules changed locations. Also I seem to remember
> 32/64 bit issues with Snow Leopard, others may have a better grip on that.
> Another thing to look at is whether load is not been changed in the query. Try
> print curs.mogrify(query,load) in the script to see what is actually happening
> after the binding of the variables.
> 
> 
> 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.