On 4-Oct-06, at 6:45 PM, Andy Dustman wrote:

> Oh, *that's* interesting. It's not really execution of the query
> that's causing the problem but the debug code that retains all
> executed queries. Although the execution could be raising the same
> exception: The part we are seeing above is in a finally clause. You
> may have to examine your local variables in that last frame to see
> what the values of sql and params are, and that may make the problem
> more obvious. Use the little triangle on the left to open it up;
> apparently it's not completely obvious to everyone that they do
> something.

I was playing around with it yesterday, and it actually seems to be  
the execution of the query that's causing problems. I commented out  
the try/finally in db/backends/util.py, like this:

def execute(self, sql, params=()):
     start = time()
     # try:
     return self.cursor.execute(sql, params)
     # finally:
     #     stop = time()
     #     # If params was a list, convert it to a tuple, because string
     #     # formatting with '%' only works with tuples or dicts.
     #     if not isinstance(params, (tuple, dict)):
     #         params = tuple(params)
     #     self.db.queries.append({
     #         'sql': sql % tuple(params),
     #         'time': "%.3f" % (stop - start),
     #     })

And that changes the traceback to this:

Traceback (most recent call last):
File "/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/ 
handlers/base.py" in get_response
   74. response = callback(request, *callback_args, **callback_kwargs)
File "/.../polls/views.py" in index
   46. pages = helpers.pager(page, paginator.pages,  
conf.SEARCH_PAGER_SHOW)
File "/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/ 
paginator.py" in _get_pages
   83. self._pages = int(ceil(self.hits / float(self.num_per_page)))
File "/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/core/ 
paginator.py" in _get_hits
   78. self._hits = self.query_set.count()
File "/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/ 
models/query.py" in count
   202. cursor.execute("SELECT COUNT(*)" + sql, params)
File "/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/ 
backends/util.py" in execute
   12. return self.cursor.execute(sql, params)
File "/lib/python2.4/site-packages/Django-0.95-py2.4.egg/django/db/ 
backends/mysql/base.py" in execute
   35. return self.cursor.execute(sql, params)
File "/lib/python2.4/site-packages/MySQLdb/cursors.py" in execute
   148. query = query % db.literal(args)

   TypeError at /search/test/
   not all arguments converted during string formatting

Beau

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users
-~----------~----~----~----~------~----~------~--~---

Reply via email to