Jump to content

Problems on .commit()


Paidi28

Recommended Posts

Posted

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 ? :)

Posted
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 :)

Posted

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

 

Posted
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!

Archived

This topic is now archived and is closed to further replies.

×
×
  • Create New...