Hi,
I was working on a event action script. It is used to collect all notes under one assetVersion and convert them to a doc which will be added to a new note.
It works fine at first. But I found that it can not collect new notes which are created after the starting time of the event script. So I think the problem may be the session cache.
Then I add a code to clear the session: session.cache.clear() at lunch function. But error shows up:
ERROR:ftrack_api.event.hub.EventHub:Error calling subscriber <Subscriber metadata={'id': '723b56730bde4abe81f3c732303f2e9f'} subscription="topic=ftrack.action.launch and data.actionIdentifier=sy.notes-to-docx"> for event <Event {'topic': u'ftrack.action.launch', 'source': {u'id': u'6347029859d2401bb850f5fada92295c', u'user': {u'username': u'chengshun', u'id': u'bcdf57b0-acc6-11e1-a554-f23c91df1211'}}, 'target': u'', 'data': {u'actionIdentifier': u'sy.notes-to-docx', u'selection': [{u'entityId': u'ac013aa4-9065-11ea-bda8-0a58ac1e069e', u'entityType': u'assetversion'}], u'label': u'Notes To Docx'}, 'in_reply_to_event': None, 'id': u'32a6a71deed7415f9e9f9b35277c30ac', 'sent': None}>.
Traceback (most recent call last):
File "c:\Python27\lib\site-packages\ftrack_api\event\hub.py", line 724, in _handle
response = subscriber.callback(event)
File "D:\git\shenyin_pipeline\ftrack\export_notes_to_doc.py", line 98, in launch
location=server_location
File "c:\Python27\lib\site-packages\ftrack_api\session.py", line 1956, in create_component
'FileComponent', path, data, location
File "c:\Python27\lib\site-packages\ftrack_api\session.py", line 2025, in _create_component
origin_location.add_component(component, path, recursive=False)
File "c:\Python27\lib\site-packages\ftrack_api\entity\location.py", line 78, in add_component
[component], sources=source, recursive=recursive
File "c:\Python27\lib\site-packages\ftrack_api\entity\location.py", line 139, in add_components
details=dict(location=self)
LocationError: No structure defined for location <Location(ce9b348f-8809-11e3-821c-20c9d081909b)>.
And the error comes from the code session.create_component()
I use cache.clear() at another event action script to create folders at the studio network storage and it works fine. Seems like only create function will go wrong after cache.clear().
I put the full script below.
Need some help, thanks.