Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 6382739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 25, 20262026-05-25T02:33:43+00:00 2026-05-25T02:33:43+00:00

Has anyone seen this error before? It comes whenever I try to execute a

  • 0

Has anyone seen this error before? It comes whenever I try to execute a query on a particular model of mine. Querying the db directly works fine and it doesn’t happen with other models.

For example, it’s triggered by something like:

MyModel.objects.get(name__iexact = 'an existent name')

I believe this started immediately after a database migration with South. I could roll back the migration but I don’t want to make bad worse so I’ve come here first.

  • Django 1.3
  • PostgreSQL 8.4.8
  • Python 2.7.0
  • iPython 0.10.2
  • Ubuntu 10.10 64-bit

Any ideas?

ERROR: An unexpected error occurred while tokenizing input
The following traceback may be corrupted or invalid
The error message is: ('EOF in multi-line statement', (173, 0))

---------------------------------------------------------------------------
AttributeError                            Traceback (most recent call last)

/home/<path to python>/<ipython console> in <module>()

/home/<path to python>/python2.7/site-packages/django/db/models/manager.pyc in get(self, *args, **kwargs)
    130 
    131     def get(self, *args, **kwargs):
--> 132         return self.get_query_set().get(*args, **kwargs)
    133 
    134     def get_or_create(self, **kwargs):

/home/<path to python>/python2.7/site-packages/django/db/models/query.pyc in get(self, *args, **kwargs)
    342         if self.query.can_filter():
    343             clone = clone.order_by()
--> 344         num = len(clone)
    345         if num == 1:
    346             return clone._result_cache[0]

/home/<path to python>/python2.7/site-packages/django/db/models/query.pyc in __len__(self)
     80                 self._result_cache = list(self._iter)
     81             else:
---> 82                 self._result_cache = list(self.iterator())
     83         elif self._iter:
     84             self._result_cache.extend(self._iter)

/home/<path to python>/python2.7/site-packages/django/db/models/query.pyc in iterator(self)
    287 
    288                 # Store the source database of the object

--> 289                 obj._state.db = db
    290                 # This object came from the database; it's not being added.

    291                 obj._state.adding = False

AttributeError: 'NoneType' object has no attribute 'db'
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-25T02:33:44+00:00Added an answer on May 25, 2026 at 2:33 am

    Kicking myself for this one, especially given how obvious the error message makes it in retrospect.

    My migration had added a new field named “_state” to the model. This field collided with the _state attribute of the object referenced in line 289 of query.pyc above.

    So new lesson: no field can be named “_state” on a Django model.

    Should this be submitted as a bug report?

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Has anyone seen this error before? An error occurred creating the configuration section handler
Has anyone seen this before: Error 1 error LNK2019: unresolved external symbol __declspec(dllimport) public:
I'm getting this error in IE8. Has anyone seen this before? Webpage error details:
Has anyone seen this problem before? When I try to run the command heroku
Has anyone seen this error when trying to call an external C function from
Has anyone seen this before - and can anything be done about it? This
I don't know if anyone has seen this issue before but I'm just stumped.
Has anyone ever come across this? I've never seen it before. I know there
Has anyone seen this very strange behaviour before? I've got a solution whith 70
Has anyone seen this? Here's the error: /System/Library/Frameworks/Ruby.framework/Versions/1.8/usr/bin/ruby -rrubygems -e require 'redgreen' -I.:lib:test -rubygems

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.