Hi, all
I am running into these 2 errors and have run out of ideas what to do about it (also because i don't what they mean); They seem to happen in exactly the same circumstances.
Traceback (most recent call last):
File "C:\python27\lib\site-packages\bottle.py", line 781, in _handle
return route.call(**args)
File "C:\python27\lib\site-packages\bottle.py", line 1592, in wrapper
rv = callback(*a, **ka)
File "d:\Documents\Code\python\floware\server\webserver.py", line 202, in post_task
task.from_json(request.json, path = pathlist([task._id_]))
File "C:\python27\lib\contextlib.py", line 24, in __exit__
self.gen.next()
File "d:\Documents\Code\python\floware\models\flow\tasks.py", line 55, in scoped_session
session.commit()
File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 721, in commit
self.transaction.commit()
File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 354, in commit
self._prepare_impl()
File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 334, in _prepare_impl
self.session.flush()
File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 1818, in flush
self._flush(objects)
File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 1936, in _flush
transaction.rollback(_capture_exception=True)
File "build\bdist.win32\egg\sqlalchemy\util\langhelpers.py", line 58, in __exit__
compat.reraise(exc_type, exc_value, exc_tb)
File "build\bdist.win32\egg\sqlalchemy\orm\session.py", line 1900, in _flush
flush_context.execute()
File "build\bdist.win32\egg\sqlalchemy\orm\unitofwork.py", line 372, in execute
rec.execute(self)
File "build\bdist.win32\egg\sqlalchemy\orm\unitofwork.py", line 525, in execute
uow
File "build\bdist.win32\egg\sqlalchemy\orm\persistence.py", line 59, in save_obj
mapper, table, update)
File "build\bdist.win32\egg\sqlalchemy\orm\persistence.py", line 514, in _emit_update_statements
(table.description, len(update), rows))
StaleDataError: UPDATE statement on table 'Company' expected to update 1 row(s); 0 were matched.
OR
File "d:\Documents\Code\python\floware\models\flow\processes.py", line 333, in run
self.execute(input, output)
File "d:\Documents\Code\python\floware\toolshed\logs.py", line 55, in wrapper
f_result = func(*v, **k)
File "d:\Documents\Code\python\floware\models\flow\libraries\basic.py", line 159, in execute
print "%s %s" % (self.cursor, str(i.item))
File "d:\Documents\Code\python\floware\models\data\database.py", line 282, in __str__
return '{%s-> %s}' %(type(self).__name__, ', '.join(['%s: %s' % (str(k), repr(getattr(self, k))) for k in self._entity_]))
File "C:\python27\lib\site-packages\sqlalchemy-0.8.3-py2.7-win32.egg\sqlalchemy\orm\attributes.py", line 316, in __get__
File "C:\python27\lib\site-packages\sqlalchemy-0.8.3-py2.7-win32.egg\sqlalchemy\orm\attributes.py", line 611, in get
File "C:\python27\lib\site-packages\sqlalchemy-0.8.3-py2.7-win32.egg\sqlalchemy\orm\state.py", line 380, in __call__
File "C:\python27\lib\site-packages\sqlalchemy-0.8.3-py2.7-win32.egg\sqlalchemy\orm\loading.py", line 606, in load_scalar_attributes
sqlalchemy.orm.exc.ObjectDeletedError: Instance '<Company at 0x5e0d550>' has been deleted, or its row is otherwise not present.
What i do is:
1 make a new object (mapped)-> obj1
2 add it to a session -> session1
3 start another session -> session2
4 do a get(id) on session2 (which should result in access to the database, since i just started the session) -> obj2
5 close session2
6 do obj1.someattr.append(obj2)
7 do session1.commit()
8 get the first ERROR above
OR
9 close session1
10 add obj1 to another session -> session3
11 do the returnb the string from __str__: return '{%s-> %s}' %(type(self).__name__, ', '.join(['%s: %s' % (str(k), repr(getattr(self, k))) for k in self._entity_])) (see stacktrace)
12 get the second ERROR above
I think thats all that could be relevant; if i don't do steps 3-6 there is no problem!
Can anyone point me in the right direction of what this error might mean, how to find the error or how to solve the problem?
Why would the first error not occur in all cases?
Cheers, Lars