Opened 11 years ago

Closed 11 years ago

#20225 closed Bug (needsinfo)

query model using `filter` or `get` occur ValueError: invalid literal for int() with base 10

Reported by: 592280502@… Owned by: nobody
Component: *.djangoproject.com Version: 1.3
Severity: Normal Keywords: ValueError
Cc: Triage Stage: Unreviewed
Has patch: no Needs documentation: no
Needs tests: no Patch needs improvement: no
Easy pickings: no UI/UX: no

Description

class User(models.Model):
identifier=models.CharField(max_length=128, unique=True, db_index=True)
..........
..........
class Token(models.Model):
user = models.ForeignKey("User", related_name="Tokens")
token_string = models.CharField(max_length=128, unique=True, db_index=True)
while I already have a tk(<Token object>),I run this:
user = User.objects.filter(id=tk.user_id) if user: user = user[0]
it cause the ValueError: invalid literal for int() with base 10:
File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 113, in nonzero
iter(self).next()
File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 107, in _result_iter
self._fill_cache()
File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 772, in _fill_cache
self._result_cache.append(self._iter.next())
File "/usr/local/lib/python2.7/site-packages/django/db/models/query.py", line 273, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 680, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/compiler.py", line 735, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/base.py", line 86, in execute
return self.cursor.execute(query, args)
File "build/bdist.linux-x86_64/egg/MySQLdb/cursors.py", line 174, in execute
self.errorhandler(self, exc, value)
File "build/bdist.linux-x86_64/egg/MySQLdb/connections.py", line 36, in defaulterrorhandler
raise errorclass, errorvalue
ValueError: invalid literal for int() with base 10: '\xd9'
but it disappeared when I restart my project, but a couple of days while running, it occured again
How does it happened and any solutions?

Change History (1)

comment:1 by Carl Meyer, 11 years ago

Resolution: needsinfo
Status: newclosed

Sorry, but without instructions to reliably reproduce the failure there's not much we can do with this.

Note: See TracTickets for help on using tickets.
Back to Top