Willem Zwarthoed Posted October 5, 2017 Report Share Posted October 5, 2017 Hi, We've migrated to ftrack 3.5 today and now I'm having a hard time debugging this error: shot_thumbnail = shot.create_thumbnail(shotObj.thumbnail) File "/../ftrack_api/entity/component.py", line 59, in create_thumbnail server_location.add_component(thumbnail_component, [origin_location]) File "/../ftrack_api/entity/location.py", line 78, in add_component [component], sources=source, recursive=recursive File "/../ftrack_api/entity/location.py", line 250, in add_components transferred=transferred LocationError: Failed to register components with location <ServerLocation("ftrack.server", 3a372bde-05bc-11e4-8908-20c9d081909b)> due to error: Server reported error: IntegrityError((_mysql_exceptions.IntegrityError) (1062, "Duplicate entry '7063f1a5-b6d3-44e9-a76f-f8958a974f53' for key 'PRIMARY'") [SQL: u'INSERT INTO context (name, id) VALUES (%s, %s)'] [parameters: (('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'), ('', u'7063f1a5-b6d3-44e9-a76f-f8958a974f53'))]) Transferred component data that may require cleanup: [(<dynamic ftrack FileComponent object 41096912>, 'db635dce-a914-431e- 9eb0-2fc8b1e00a03')] This is now happening on all scripted components I'm creating, but I'm not 100% sure the migration is to blame. Here's an edited sample of what I'm doing: shot_data = {} shot_data["entity"] = { 'name' : shotObj.shot, 'status' : shot_status, 'description' : shotObj.description } shot_data["custom_attributes"] = { 'Colorspace' : [shotObj.out_colorspace], 'Resolution' : [shotObj.out_res], 'fstart' : shotObj.first_frame_no, 'fend' : shotObj.last_frame_no, 'viewlut' : [shotObj.viewlut], 'Extension' : [shotObj.out_file_type], 'Frame Aspect' : [shotObj.frame_aspect], 'FPS' : [shotObj.fps], 'handles' : shotObj.handles } shot_data["metadata"] = {} for key, value in sorted(shotObj.__dict__.iteritems()): if key not in ['widget','task_list']: shot_data["metadata"][key] = str(value) shot = session.create( 'Shot', shot_data["entity"]) shot["custom_attributes"] = shot_data["custom_attributes"] shot["metadata"] = shot_data["metadata"] shot_thumbnail = shot.create_thumbnail(shotObj.thumbnail) I really don't understand what this error is trying to tell me. When I simply select an existing shot and use the create_thumbnail method everything is fine. Any help would be greatly appreciated! Willem Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted October 5, 2017 Report Share Posted October 5, 2017 Hi Willem, I saw that you opened a support-case for this issue. Let us handle it through support and perhaps add a summary of the solution afterwards when we know what the problem is. Link to comment Share on other sites More sharing options...
Willem Zwarthoed Posted October 5, 2017 Author Report Share Posted October 5, 2017 Great, thanks Matthias! Link to comment Share on other sites More sharing options...
Willem Zwarthoed Posted October 5, 2017 Author Report Share Posted October 5, 2017 Ok, so the issue was with these lines: shot["custom_attributes"] = shot_data["custom_attributes"] shot["metadata"] = shot_data["metadata"] which doesn't work anymore, at least with ftrack 3.5.9 and API version 1.0.4. All credits to Eric Hermelin from ftrack support for figuring it out and providing the solution: for key, value in shot_data["custom_attributes"].items(): shot['custom_attributes'][key] = value for key, value in shot_data["metadata"].items(): shot['metadata'][key] = value Everything is working fine again now. Thanks Eric and Matthias for resolving this quickly! Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.