Annoying can't adapt problem

1 view
Skip to first unread message

Newt

unread,
Sep 9, 2009, 3:46:44 AM9/9/09
to Satchmo users
Hello,

has anyone encoutered problem when you get the 'can't adapt' error
when checking out (steps 2 and 3)??
it's problem on satchmo 8.1 with both django 1.0 and 1.1
it happens just sometimes, so refreshing page helps. I went through
the critical lines and all seem to be fine.

I'll upgrade to satchmo 0.9+ soon, but until then I have to get this
running.

File "/home/newt/django/1.0/lib/satchmo/payment/forms.py", line 43,
in _get_shipping_choices
if method.valid():

File "/home/newt/django/1.0/lib/satchmo/shipping/modules/tiered/
models.py", line 86, in valid
price = self.cost()

File "/home/newt/django/1.0/lib/satchmo/shipping/modules/tiered/
models.py", line 51, in cost
return self.carrier.price(total)

File "/home/newt/django/1.0/lib/satchmo/shipping/modules/tiered/
models.py", line 188, in price
if not prices.count() > 0:

File "/home/newt/django/1.0/lib/django/db/models/query.py", line
292, in count
return self.query.get_count()

File "/home/newt/django/1.0/lib/django/db/models/sql/query.py", line
376, in get_count
number = obj.get_aggregation()[None]

File "/home/newt/django/1.0/lib/django/db/models/sql/query.py", line
348, in get_aggregation
result = query.execute_sql(SINGLE)

File "/home/newt/django/1.0/lib/django/db/models/sql/query.py", line
2369, in execute_sql
cursor.execute(sql, params)

ProgrammingError: can't adapt


Thanks for your help,

Ales

Chris Moffitt

unread,
Sep 9, 2009, 10:19:32 AM9/9/09
to satchm...@googlegroups.com
Which database are you using? If you try sqlite for testing purposes, do you see the same thing?

-Chris

Newt

unread,
Sep 10, 2009, 9:07:11 AM9/10/09
to Satchmo users
I use postgresql with psycopg2, mod_python on ubuntu 8.04

I'll try with other databases.

Is there any known issue with this configuration?

Ales


On Sep 9, 4:19 pm, Chris Moffitt <ch...@moffitts.net> wrote:
> Which database are you using? If you try sqlite for testing purposes, do you
> see the same thing?
>
> -Chris
>

Günter Walser

unread,
Sep 10, 2009, 9:35:04 AM9/10/09
to satchm...@googlegroups.com
I don't think it’s the configuration.

I suggest you open home/newt/django/1.0/lib/django/db/models/sql/query.py,
Go to line 2369 and insert print 'The SQL:\n, sql; print 'The
Parameters:\n, params
Statements.

Then you analyze your parameters if there is a strange value when the error
happens, eg None values or similar strangeness's which aren't accepted by
PostgreSQL.

And if you find something strange you track where it comes from, maybe from
line
number = obj.get_aggregation()[None] which can be seen in your traceback.

Hope this might help to narrow down the root cause,

Rgds
Günter

-----Ursprüngliche Nachricht-----
Von: satchm...@googlegroups.com [mailto:satchm...@googlegroups.com]
Im Auftrag von Newt
Gesendet: Donnerstag, 10. September 2009 15:07
An: Satchmo users
Betreff: Re: Annoying can't adapt problem

Corey Oordt

unread,
Sep 10, 2009, 10:48:45 AM9/10/09
to satchm...@googlegroups.com
I have had this problem as well, and discovered that it is a bug in
psycopg2.

If you have multiple sites on the same server, using the same
psycopg2, you will run into this error.

I successfully fixed it by running my sites using mod_wsgi in daemon
mode and using virtualenv.

I highly recommend the approach.

Yours,

Corey

On Sep 10, 2009, at 9:35 AM, Günter Walser wrote:

>
> I don't think it’s the configuration.
>
> I suggest you open home/newt/django/1.0/lib/django/db/models/sql/
> query.py,
> Go to line 2369 and insert print 'The SQL:\n, sql; print 'The
> Parameters:\n, params
> Statements.
>
> Then you analyze your parameters if there is a strange value when
> the error
> happens, eg None values or similar strangeness's which aren't
> accepted by
> PostgreSQL.
>
> And if you find something strange you track where it comes from,
> maybe from
> line
> number = obj.get_aggregation()[None] which can be seen in your
> traceback.
>
> Hope this might help to narrow down the root cause,
>
> Rgds
> Günter
>
> -----Ursprüngliche Nachricht-----
> Von: satchm...@googlegroups.com [mailto:satchmo-
> us...@googlegroups.com]

Ricardo Silva

unread,
Sep 14, 2009, 7:41:08 PM9/14/09
to satchm...@googlegroups.com
I had this problem when inserting strings values with unicode characteres. Try to use your_object.field = unicode(your_string) on all strings fields before save the object.

Bruce Kroeze

unread,
Sep 14, 2009, 8:01:08 PM9/14/09
to satchm...@googlegroups.com
On Thu, Sep 10, 2009 at 7:48 AM, Corey Oordt <corey...@gmail.com> wrote:
>
> I have had this problem as well, and discovered that it is a bug in
> psycopg2.
>
> If you have multiple sites on the same server, using the same
> psycopg2, you will run into this error.
>
> I successfully fixed it by running my sites using mod_wsgi in daemon
> mode and using virtualenv.
>
> I highly recommend the approach.

Avoid mod_python with multiple sites! I've had many memory leaks and
other oddness.

--
Bruce Kroeze
http://www.ecomsmith.com
It's time to hammer your site into shape.

Max

unread,
Sep 24, 2009, 7:10:55 AM9/24/09
to Satchmo users
I have also encountered this error. I moved to mod_wsgi (I believe it
is running in daemon mode by default) and we already use virtualenv
but I still have the error.

Do you use any specific WSGI settings such as WSGIDaemonProcess /
WSGIProcessGroup?
Reply all
Reply to author
Forward
0 new messages