On Mar 27, 2010, at 3:28 PM, Fernando Takai wrote:

>> is it possible your object is present in a session that is, in a different 
>> thread, being expired as this operation runs ?
> I don't know, but i can verify that.
> If that is happening, what can i do to prevent?

an object associated with a session should only be dealt with in that thread's 
session.   session isn't threadsafe.




> 
> 
>> Well seems like the project you want to access is just None. SA can't do 
>> anything with it. I had a similar problem recently, it was…
> I'm not trying to access anything, i'm just trying to merge the object
> into the session…
> 
> On Sat, Mar 27, 2010 at 3:25 PM, Michael Bayer <mike...@zzzcomputing.com> 
> wrote:
>> 
>> On Mar 27, 2010, at 12:42 PM, Fernando Takai wrote:
>> 
>>> Hi all!
>>> 
>>> I'm running SQLAlchemy 0.6b2 for a while and i've seem some strange
>>> exception (AttributeError: 'NoneType' object has no attribute
>>> '_sa_iterator') happening one in a while.
>>> This is my stacktrace:
>>> 
>>> Traceback (most recent call last):
>>>  File "/usr/lib/python2.5/threading.py", line 486, in __bootstrap_inner
>>>    self.run()
>>>  File "/usr/lib/python2.5/threading.py", line 446, in run
>>>    self.__target(*self.__args, **self.__kwargs)
>>>  File "./db/models/job.py", line 109, in run
>>>    func(self)
>>>  File "./queue/queue.py", line 284, in job_finished
>>>    job = session.merge(job)
>>>  File 
>>> "/usr/lib/python2.5/site-packages/SQLAlchemy-0.6beta2-py2.5-linux-x86_64.egg/sqlalchemy/orm/session.py",
>>> line 1126, in merge
>>>    load=load, _recursive=_recursive)
>>>  File 
>>> "/usr/lib/python2.5/site-packages/SQLAlchemy-0.6beta2-py2.5-linux-x86_64.egg/sqlalchemy/orm/session.py",
>>> line 1188, in _merge
>>>    prop.merge(self, state, state_dict, merged_state, merged_dict,
>>> load, _recursive)
>>>  File 
>>> "/usr/lib/python2.5/site-packages/SQLAlchemy-0.6beta2-py2.5-linux-x86_64.egg/sqlalchemy/orm/properties.py",
>>> line 681, in merge
>>>    obj = session._merge(current_state, current_dict, load=load,
>>> _recursive=_recursive)
>>>  File 
>>> "/usr/lib/python2.5/site-packages/SQLAlchemy-0.6beta2-py2.5-linux-x86_64.egg/sqlalchemy/orm/session.py",
>>> line 1188, in _merge
>>>    prop.merge(self, state, state_dict, merged_state, merged_dict,
>>> load, _recursive)
>>>  File 
>>> "/usr/lib/python2.5/site-packages/SQLAlchemy-0.6beta2-py2.5-linux-x86_64.egg/sqlalchemy/orm/properties.py",
>>> line 661, in merge
>>>    for current in instances:
>>>  File 
>>> "/usr/lib/python2.5/site-packages/SQLAlchemy-0.6beta2-py2.5-linux-x86_64.egg/sqlalchemy/orm/collections.py",
>>> line 570, in __iter__
>>>    return iter(getattr(self._data(), '_sa_iterator')())
>>> AttributeError: 'NoneType' object has no attribute '_sa_iterator'
>> 
>> is it possible your object is present in a session that is, in a different 
>> thread, being expired as this operation runs ?
>> 
>> 
>> 
>> 
>> 
>> 
>>> 
>>> I don't have a good test for this, but i'm trying to create one.
>>> Does anyone knows why this is happening?
>>> 
>>> Thanks!
>>> 
>>> --
>>> Fernando Takai
>>> 
>>> --
>>> You received this message because you are subscribed to the Google Groups 
>>> "sqlalchemy" group.
>>> To post to this group, send email to sqlalch...@googlegroups.com.
>>> To unsubscribe from this group, send email to 
>>> sqlalchemy+unsubscr...@googlegroups.com.
>>> For more options, visit this group at 
>>> http://groups.google.com/group/sqlalchemy?hl=en.
>>> 
>> 
>> --
>> You received this message because you are subscribed to the Google Groups 
>> "sqlalchemy" group.
>> To post to this group, send email to sqlalch...@googlegroups.com.
>> To unsubscribe from this group, send email to 
>> sqlalchemy+unsubscr...@googlegroups.com.
>> For more options, visit this group at 
>> http://groups.google.com/group/sqlalchemy?hl=en.
>> 
>> 
> 
> 
> 
> -- 
> Fernando Takai
> 
> -- 
> You received this message because you are subscribed to the Google Groups 
> "sqlalchemy" group.
> To post to this group, send email to sqlalch...@googlegroups.com.
> To unsubscribe from this group, send email to 
> sqlalchemy+unsubscr...@googlegroups.com.
> For more options, visit this group at 
> http://groups.google.com/group/sqlalchemy?hl=en.
> 

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

Reply via email to