Account Options

  1. Sign in
The old Google Groups will be going away soon, but your browser is incompatible with the new version.
Google Groups Home
« Groups Home
can't adapt type 'Decimal'
There are currently too many topics in this group that display first. To make this topic appear first, remove this option from another topic.
There was an error processing your request. Please try again.
flag
  6 messages - Collapse all  -  Translate all to Translated (View all originals)
The group you are posting to is a Usenet group. Messages posted to this group will make your email address visible to anyone on the Internet.
Your reply message has not been sent.
Your post was successful
 
From:
To:
Cc:
Followup To:
Add Cc | Add Followup-to | Edit Subject
Subject:
Validation:
For verification purposes please type the characters you see in the picture below or the numbers you hear by clicking the accessibility icon. Listen and type the numbers you hear
 
poupou  
View profile  
 More options Jun 25 2010, 9:06 am
From: poupou <etiennepoul...@gmail.com>
Date: Fri, 25 Jun 2010 06:06:27 -0700 (PDT)
Local: Fri, Jun 25 2010 9:06 am
Subject: can't adapt type 'Decimal'
Hi,

  I'm getting the error "can't adapt type 'Decimal'"  from time to
time in my Django web site.  Once I restart Apache it will works for
few hours, then some users will start to get this error.

  Of the 2 web site that I have, It only happens where I make request
using the the Q objects.

  For example this request :

        projets = Projet.objects.filter(Q(termine = u'Non') |
Q(heure_difference__gt = 0 |
                                        Q(termine = u'Oui') &
Q(base_renumeration = u'Forfait'))
        for projet in projets:

Wich will end up and with the following traceback :

Traceback:
File "/usr/lib/python2.4/site-packages/django/core/handlers/base.py"
in get_response
  92.                 response = callback(request, *callback_args,
**callback_kwargs)
File "/usr/lib/python2.4/site-packages/django/contrib/auth/
decorators.py" in __call__
  78.             return self.view_func(request, *args, **kwargs)
File "/var/www/django/defitek/gestion/views.py" in projet_en_cours
  128.         for projet in projets:
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_result_iter
  106.                 self._fill_cache()
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
_fill_cache
  692.
self._result_cache.append(self._iter.next())
File "/usr/lib/python2.4/site-packages/django/db/models/query.py" in
iterator
  238.         for row in self.query.results_iter():
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in results_iter
  287.         for rows in self.execute_sql(MULTI):
File "/usr/lib/python2.4/site-packages/django/db/models/sql/query.py"
in execute_sql
  2369.         cursor.execute(sql, params)
File "/usr/lib/python2.4/site-packages/django/db/backends/util.py" in
execute
  19.             return self.cursor.execute(sql, params)

Exception Type: ProgrammingError at /projet_en_cours/
Exception Value: can't adapt type 'Decimal'

Here are the value that it tryed to use in the request :

            return self.cursor.execute(sql, params) ...
▶ Local vars
Variable
Value
params
  (u'Non', Decimal("0"), u'Oui', u'Forfait')
  self
  <django.db.backends.util.CursorDebugWrapper object at 0x9a585ec>
  sql
  None
  start
  1277468406.010195
  stop
  1277468406.010242

I'm using : Django 1.1.1, CentOS 5.5, Python-2.4.3-27, mod_wsgi 3.2
and psycopg2-2.2.1

I read many thread that had a can't adapt error, it seems to be
something wrong with psycopg2.  But I have yet to figure out how to
fix this.

Please help.  Thank you.


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stuart  
View profile   Translate to Translated (View Original)
 More options Jun 25 2010, 10:06 am
From: Stuart <stu...@bistrotech.net>
Date: Fri, 25 Jun 2010 07:06:23 -0700 (PDT)
Local: Fri, Jun 25 2010 10:06 am
Subject: Re: can't adapt type 'Decimal'
On Jun 25, 8:06 am, poupou <etiennepoul...@gmail.com> wrote:

>   Of the 2 web site that I have, It only happens where I make request
> using the the Q objects.

Your problem sounds like the problem I just went through. I assume you
are using mod_wsgi. Are the two sites on the same server? For example,
you have one at http://myserver/app1 and the other at http://myserver/app2
-- is that right?

If that's your scenario, upgrade to the latest version of mod_wsgi and
set it to run in daemon mode. For details on how to do that, see here:
http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323

Hope that helps,

--Stuart


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Stuart  
View profile   Translate to Translated (View Original)
 More options Jun 25 2010, 10:51 am
From: Stuart <stu...@bistrotech.net>
Date: Fri, 25 Jun 2010 07:51:19 -0700 (PDT)
Local: Fri, Jun 25 2010 10:51 am
Subject: Re: can't adapt type 'Decimal'
On Jun 25, 8:06 am, poupou <etiennepoul...@gmail.com> wrote:

>   Of the 2 web site that I have, It only happens where I make request
> using the the Q objects.

If you have two django sites/projects on the same server (e.g.
http://myserver/app1 and http://myserver/app2) and you are using
mod_wsgi, I bet you're having the same problem I was. To fix it,
upgrade to the latest version of mod_wsgi and run it in daemon mode.
See here for details: http://groups.google.com/group/satchmo-users/msg/a9b22c236d63c323

Hope that helps,

--Stuart


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
poupou  
View profile  
 More options Jun 25 2010, 1:12 pm
From: poupou <etiennepoul...@gmail.com>
Date: Fri, 25 Jun 2010 10:12:10 -0700 (PDT)
Local: Fri, Jun 25 2010 1:12 pm
Subject: Re: can't adapt type 'Decimal'
Yes I'm running two sites on the same server.  Only difference with
you is that I'm running it with virtual host.

I modifier my Apache config, now it looks like this :

<VirtualHost *:443>
  ServerName  site1.com
  WSGIDaemonProcess site1
  WSGIScriptAlias / /var/www/site1.wsgi process-group=site1
application-group=%{GLOBAL}

</VirtualHost>

<VirtualHost *:443>
  ServerName  site2.com
  WSGIDaemonProcess site2
  WSGIScriptAlias / /var/www/site2.wsgi process-group=site2
application-group=%{GLOBAL}

</VirtualHost>

It will take a little to make sure it's working, I will report on this
thread if everything is ok.

Thank you!

On 25 juin, 10:51, Stuart <stu...@bistrotech.net> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
poupou  
View profile  
 More options Jun 28 2010, 5:01 pm
From: poupou <etiennepoul...@gmail.com>
Date: Mon, 28 Jun 2010 14:01:02 -0700 (PDT)
Local: Mon, Jun 28 2010 5:01 pm
Subject: Re: can't adapt type 'Decimal'
I confirm that everything is working fine now.

Thank you again.

On 25 juin, 13:12, poupou <etiennepoul...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
Gabriel Farrell  
View profile  
 More options Aug 24 2010, 12:16 pm
From: Gabriel Farrell <gsf...@gmail.com>
Date: Tue, 24 Aug 2010 09:16:56 -0700 (PDT)
Local: Tues, Aug 24 2010 12:16 pm
Subject: Re: can't adapt type 'Decimal'
(I tried to post the below in a comment at poupou's site (http://
www.defitek.com/blog/2010/06/29/cant-adapt-type-decimal-error-with-dj...),
but kept getting errors.)

Just ran into the same problem. In my mod_wsgi config I had:

    WSGIDaemonProcess site1 maximum-requests=10000
    WSGIProcessGroup site1
    WSGIScriptAlias /site1 /var/www/site1/django.wsgi

    WSGIDaemonProcess site2 maximum-requests=10000
    WSGIProcessGroup site2
    WSGIScriptAlias /site2 /var/www/site2/django.wsgi

I was getting errors with that, but with the "process-group" parameter
things are running fine. Funny that at http://code.google.com/p/modwsgi/wiki/ConfigurationDirectives
the only place where "process-group" is mentioned is in the
WSGIImportScript section.

On Jun 28, 5:01 pm, poupou <etiennepoul...@gmail.com> wrote:


 
You must Sign in before you can post messages.
To post a message you must first join this group.
Please update your nickname on the subscription settings page before posting.
You do not have the permission required to post.
End of messages
« Back to Discussions « Newer topic     Older topic »