Opened 3 years ago

Closed 3 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: * 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


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/", line 113, in nonzero
File "/usr/local/lib/python2.7/site-packages/django/db/models/", line 107, in _result_iter
File "/usr/local/lib/python2.7/site-packages/django/db/models/", line 772, in _fill_cache
File "/usr/local/lib/python2.7/site-packages/django/db/models/", line 273, in iterator
for row in compiler.results_iter():
File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/", line 680, in results_iter
for rows in self.execute_sql(MULTI):
File "/usr/local/lib/python2.7/site-packages/django/db/models/sql/", line 735, in execute_sql
cursor.execute(sql, params)
File "/usr/local/lib/python2.7/site-packages/django/db/backends/mysql/", line 86, in execute
return self.cursor.execute(query, args)
File "build/bdist.linux-x86_64/egg/MySQLdb/", line 174, in execute
self.errorhandler(self, exc, value)
File "build/bdist.linux-x86_64/egg/MySQLdb/", 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 Changed 3 years ago by carljm

  • Needs documentation unset
  • Needs tests unset
  • Patch needs improvement unset
  • Resolution set to needsinfo
  • Status changed from new to closed

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