Ouch, there was a % in the generated SQL. Guess I should have debugged a little more before posting here. :)
On Apr 5, 1:44 pm, shabda <[EMAIL PROTECTED]> wrote: > I am using MYSql with latin-1 encoding. > > I get some weird intermittent errors when using custom sql. I have a > large programatically generated sql, and when I try to run this as > cursor.execute(sql), it works sometime but fails other times. The only > big difference I can see between the sqls is that whenever it fails it > has a unicode char. Traceback follows. Any pointers where I should be > looking to solve this problem. > > G:\tapicks\news\cron.py in find_recommeneded_for_username(username) > 114 import pdb > 115 pdb.set_trace() > --> 116 cursor.execute(sql) > 117 return cursor.fetchall() > 118 > > C:\Python24\lib\site-packages\django\db\backends\util.py in > execute(self, sql, params) > 19 finally: > 20 stop = time() > ---> 21 sql = self.db.ops.last_executed_query(self.cursor, > sql, params) > 22 self.db.queries.append({ > 23 'sql': sql, > > C:\Python24\lib\site-packages\django\db\backends\__init__.py in > last_executed_query(self, cursor, sql, params) > 148 u_params = dict([(to_unicode(k), to_unicode(v)) > for k, v in params.items()]) > 149 > --> 150 return smart_unicode(sql) % u_params > 151 > 152 def last_insert_id(self, cursor, table_name, pk_name): > > TypeError: not enough arguments for format string --~--~---------~--~----~------------~-------~--~----~ 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?hl=en -~----------~----~----~----~------~----~------~--~---