[sqlalchemy] Re: AttributeError: 'NoneType' object has no attribute 'pop'

2020-08-21 Thread ling...@gmail.com
AttributeError means that there was an Error that had to do with an 
Attribute request. In general, when you write x.y, y is the purported 
attribute of x. NoneType means that instead of an instance of whatever 
Class or Object you think you're working with, you've actually got None 
. That usually means 
that an assignment or function call up failed or returned an unexpected 
result.

mylist = mylist.sort()

The sort() method of a list sorts the list in-place, that is, mylist is 
modified. But the actual return value of the method is None and not the 
list sorted. So you've just assigned None to mylist. If you next try to do, 
say, mylist.append(1) Python will give you this error.



On Tuesday, November 11, 2008 at 6:58:41 AM UTC+5:30 arashf wrote:

> Traceback (most recent call last):
> File "/srv/server/metaserver/metaserver/lib/base.py", line 56, in
> __call__
> ret = WSGIController.__call__(self, environ, start_response)
> File "/usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/pylons/
> controllers/core.py", line 195, in __call__
> after = self._inspect_call(self.__after__)
> wasn't getting this on the betas of sqlalchemy, but am getting it on
> rc3. any ideas?
>
> File "/usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/pylons/
> controllers/core.py", line 79, in _inspect_call
> result = func(**args)
> File "/srv/server/metaserver/metaserver/lib/base.py", line 96, in
> __after__
> metaserver.model.Session.commit()
> File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
> sqlalchemy/orm/scoping.py", line 121, in do
> return getattr(self.registry(), name)(*args, **kwargs)
> File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
> sqlalchemy/orm/session.py", line 670, in commit
> self.transaction.commit()
> File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
> sqlalchemy/orm/session.py", line 385, in commit
> self._remove_snapshot()
> File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
> sqlalchemy/orm/session.py", line 306, in _remove_snapshot
> _expire_state(s, None)
> File "/usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
> sqlalchemy/orm/attributes.py", line 985, in expire_attributes
> self.dict.pop(key, None)
> AttributeError: 'NoneType' object has no attribute 'pop'

-- 
SQLAlchemy - 
The Python SQL Toolkit and Object Relational Mapper

http://www.sqlalchemy.org/

To post example code, please provide an MCVE: Minimal, Complete, and Verifiable 
Example.  See  http://stackoverflow.com/help/mcve for a full description.
--- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To view this discussion on the web visit 
https://groups.google.com/d/msgid/sqlalchemy/0015b592-77c1-4161-b7da-bd23f72a7023n%40googlegroups.com.


[sqlalchemy] Re: AttributeError: 'NoneType' object has no attribute 'pop'

2008-11-11 Thread Michael Bayer

someone ran into a variant of it earlier, and we've had other variants  
in the past.

On Nov 10, 2008, at 10:36 PM, arashf wrote:


 gotcha, cool. was I first to run into this? :-)

 On Nov 10, 5:57 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 yeah this is an enhancement we made, whereby InstanceState removes
 circular references from itself when its host object is garbage
 collected, thereby taking the load off of gc (and it does).   So in
 this case, asynchronous gc is occurring right as InstanceState is
 doing expire_attributes on itself, and the dict is getting swiped.
 We had this issue and did a None check, but that's obviously not
 enough since...well its asynchronous.  So r5283 turns state.dict
 into an attribute that will always spit out a dictionary if the  
 real
 one was removed, and its looking like rc4 will be sooner rather than
 later as we are hitting a few glitches like this.

 On Nov 10, 2008, at 8:28 PM, arashf wrote:



 Traceback (most recent call last):
 File /srv/server/metaserver/metaserver/lib/base.py, line 56, in
 __call__
 ret = WSGIController.__call__(self, environ, start_response)
 File /usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/
 pylons/
 controllers/core.py, line 195, in __call__
 after = self._inspect_call(self.__after__)
 wasn't getting this on the betas of sqlalchemy, but am getting it on
 rc3. any ideas?

 File /usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/
 pylons/
 controllers/core.py, line 79, in _inspect_call
 result = func(**args)
 File /srv/server/metaserver/metaserver/lib/base.py, line 96, in
 __after__
 metaserver.model.Session.commit()
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- 
 py2.5.egg/
 sqlalchemy/orm/scoping.py, line 121, in do
 return getattr(self.registry(), name)(*args, **kwargs)
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- 
 py2.5.egg/
 sqlalchemy/orm/session.py, line 670, in commit
 self.transaction.commit()
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- 
 py2.5.egg/
 sqlalchemy/orm/session.py, line 385, in commit
 self._remove_snapshot()
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- 
 py2.5.egg/
 sqlalchemy/orm/session.py, line 306, in _remove_snapshot
 _expire_state(s, None)
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3- 
 py2.5.egg/
 sqlalchemy/orm/attributes.py, line 985, in expire_attributes
 self.dict.pop(key, None)
 AttributeError: 'NoneType' object has no attribute 'pop'
 


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



[sqlalchemy] Re: AttributeError: 'NoneType' object has no attribute 'pop'

2008-11-10 Thread Michael Bayer

yeah this is an enhancement we made, whereby InstanceState removes  
circular references from itself when its host object is garbage  
collected, thereby taking the load off of gc (and it does).   So in  
this case, asynchronous gc is occurring right as InstanceState is  
doing expire_attributes on itself, and the dict is getting swiped.
We had this issue and did a None check, but that's obviously not  
enough since...well its asynchronous.  So r5283 turns state.dict  
into an attribute that will always spit out a dictionary if the real  
one was removed, and its looking like rc4 will be sooner rather than  
later as we are hitting a few glitches like this.


On Nov 10, 2008, at 8:28 PM, arashf wrote:


 Traceback (most recent call last):
 File /srv/server/metaserver/metaserver/lib/base.py, line 56, in
 __call__
 ret = WSGIController.__call__(self, environ, start_response)
 File /usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/ 
 pylons/
 controllers/core.py, line 195, in __call__
 after = self._inspect_call(self.__after__)
 wasn't getting this on the betas of sqlalchemy, but am getting it on
 rc3. any ideas?

 File /usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/ 
 pylons/
 controllers/core.py, line 79, in _inspect_call
 result = func(**args)
 File /srv/server/metaserver/metaserver/lib/base.py, line 96, in
 __after__
 metaserver.model.Session.commit()
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
 sqlalchemy/orm/scoping.py, line 121, in do
 return getattr(self.registry(), name)(*args, **kwargs)
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
 sqlalchemy/orm/session.py, line 670, in commit
 self.transaction.commit()
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
 sqlalchemy/orm/session.py, line 385, in commit
 self._remove_snapshot()
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
 sqlalchemy/orm/session.py, line 306, in _remove_snapshot
 _expire_state(s, None)
 File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
 sqlalchemy/orm/attributes.py, line 985, in expire_attributes
 self.dict.pop(key, None)
 AttributeError: 'NoneType' object has no attribute 'pop'
 


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



[sqlalchemy] Re: AttributeError: 'NoneType' object has no attribute 'pop'

2008-11-10 Thread arashf

gotcha, cool. was I first to run into this? :-)

On Nov 10, 5:57 pm, Michael Bayer [EMAIL PROTECTED] wrote:
 yeah this is an enhancement we made, whereby InstanceState removes  
 circular references from itself when its host object is garbage  
 collected, thereby taking the load off of gc (and it does).   So in  
 this case, asynchronous gc is occurring right as InstanceState is  
 doing expire_attributes on itself, and the dict is getting swiped.    
 We had this issue and did a None check, but that's obviously not  
 enough since...well its asynchronous.  So r5283 turns state.dict  
 into an attribute that will always spit out a dictionary if the real  
 one was removed, and its looking like rc4 will be sooner rather than  
 later as we are hitting a few glitches like this.

 On Nov 10, 2008, at 8:28 PM, arashf wrote:



  Traceback (most recent call last):
  File /srv/server/metaserver/metaserver/lib/base.py, line 56, in
  __call__
  ret = WSGIController.__call__(self, environ, start_response)
  File /usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/
  pylons/
  controllers/core.py, line 195, in __call__
  after = self._inspect_call(self.__after__)
  wasn't getting this on the betas of sqlalchemy, but am getting it on
  rc3. any ideas?

  File /usr/lib/python2.5/site-packages/Pylons-0.9.6.2-py2.5.egg/
  pylons/
  controllers/core.py, line 79, in _inspect_call
  result = func(**args)
  File /srv/server/metaserver/metaserver/lib/base.py, line 96, in
  __after__
  metaserver.model.Session.commit()
  File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
  sqlalchemy/orm/scoping.py, line 121, in do
  return getattr(self.registry(), name)(*args, **kwargs)
  File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
  sqlalchemy/orm/session.py, line 670, in commit
  self.transaction.commit()
  File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
  sqlalchemy/orm/session.py, line 385, in commit
  self._remove_snapshot()
  File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
  sqlalchemy/orm/session.py, line 306, in _remove_snapshot
  _expire_state(s, None)
  File /usr/lib/python2.5/site-packages/SQLAlchemy-0.5.0rc3-py2.5.egg/
  sqlalchemy/orm/attributes.py, line 985, in expire_attributes
  self.dict.pop(key, None)
  AttributeError: 'NoneType' object has no attribute 'pop'
--~--~-~--~~~---~--~~
You received this message because you are subscribed to the Google Groups 
sqlalchemy group.
To post to this group, send email to sqlalchemy@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/sqlalchemy?hl=en
-~--~~~~--~~--~--~---