Paidi28 Posted March 29, 2016 Report Posted March 29, 2016 I am receiving an issue upon committing my session. I am changing the asset's status. Provided is some of the error log. No handlers could be found for logger "ftrack_api.session.Session" Traceback (most recent call last): in line 96, in ft_updateOneTask session.commit() File "C:\Python27\lib\site-packages\ftrack_api\session.py", line 1172, in commit result = self._call(batch) File "C:\Python27\lib\site-packages\ftrack_api\session.py", line 1524, in _call raise ftrack_api.exception.ServerError(error_message) ftrack_api.exception.ServerError: Server reported error: AttributeError('unicode' object has no attribute '_sa_instance_state') Can you help guys ?
Mattias Lagergren Posted March 30, 2016 Report Posted March 30, 2016 Hey, Could you provide a minimum reproducible example of the code that generates this issue?
Paidi28 Posted March 30, 2016 Author Report Posted March 30, 2016 def ft_updateOneTask(taskID,newStatusName): session = ftrack_api.Session() currentTask = session.query('Task where id is '+taskID+'').one() print("Previous Status : " + currentTask['status']['name']) currentTask['status'] = newStatusName currentTask = session.query('Task where id is '+taskID+'').one() print currentTask['status'] for operation in session.recorded_operations: print operation session.commit() print("New Status : " + newStatusName) Using a second query after changing the status I can tell that the status has changed locally. Not sure my self why the commit fails, thank you for your help
Mattias Lagergren Posted March 30, 2016 Report Posted March 30, 2016 It looks like you are setting the status' name as task status. If you set it to a status instead, does it work then? Something like: # Set the task to a status object rather than it's name. status = session.query('Status where name is "{0}"'.format(status_name)').first() currenTask['status'] = status
Paidi28 Posted March 30, 2016 Author Report Posted March 30, 2016 2 minutes ago, Mattias Lagergren said: It looks like you are setting the status' name as task status. If you set it to a status instead, does it work then? Something like: # Set the task to a status object rather than it's name. status = session.query('Status where name is "{0}"'.format(status_name)').first() currenTask['status'] = status Ah I see where I went wrong now ! That works a charm thanks!
Recommended Posts
Archived
This topic is now archived and is closed to further replies.