Tim Edelmann Posted January 8, 2018 Report Share Posted January 8, 2018 Hey there, we are trying to add managers programatically when a corresponding field was altered. We tried this: project = ftrack.getProject('dev_tutorial') user = ftrack.User('username') managerType = ftrack.ManagerType('Supervisor') # Add the user as a supervisor on the dev_tutorial project. manager = project.createManager(user, managerType) (taking a correct project, user and managerType) ..which is described here. But sadly this didn't work. what do we have to do to create these managers via the new api, since 'Manager' is not a known type? Generally: it helps a lot going through the migration notes and code-snippets to get hints on how to use the new api, but every now and then, we stumble on something, that can not be found. Is there a common way to find out usages? EDIT: Some addition information: This is the line that crashes: manager = project.createManager(userToUse, managerType) the resulting log gives us: 2018-01-09 10:20:00,404 - ftrack_api.event.hub.EventHub - ERROR - Error calling subscriber <Subscriber metadata={'id': '619a63bab1c443d09f4d982926e36196'} subscription="topic=ftrack.update"> for event <Event {'topic': u'ftrack.update', 'source': {u'applicationId': u'ftrack.client.web', u'user': {u'username': u'TEdelmann', u'id': u'75b59aae-e1bb-11e7-ad88-7ab7a47c9dda'}, u'id': u'b85b77aa-f51d-11e7-92c6-7ab7a47c9dda'}, 'target': u'', 'data': {u'entities': [{u'keys': [u'Briefing_Team_01_TandemProducer_EUsers'], u'objectTypeId': u'show', u'entityType': u'show', u'parents': [{u'entityId': u'108157f2-e3d9-11e7-9067-7ab7a47c9dda', u'entityType': u'show', u'parentId': None}], u'parentId': None, u'action': u'update', u'entityId': u'108157f2-e3d9-11e7-9067-7ab7a47c9dda', u'changes': {u'Briefing_Team_01_TandemProducer_EUsers': {u'new': u'Daniel Brylka', u'old': u'Daniel Schindler'}}}], u'pushToken': u'b91a65ca-f51d-11e7-b15d-7ab7a47c9dda', u'parents': [u'108157f2-e3d9-11e7-9067-7ab7a47c9dda'], u'user': {u'userid': u'75b59aae-e1bb-11e7-ad88-7ab7a47c9dda', u'name': u'Tim Edelmann'}, u'clientToken': u'b85b77aa-f51d-11e7-92c6-7ab7a47c9dda'}, 'in_reply_to_event': None, 'id': u'5e7358c282f448729f42a0d342bdd3d3', 'sent': None}>. Traceback (most recent call last): File "c:\python27\lib\site-packages\ftrack_python_api-1.3.3-py2.7.egg\ftrack_api\event\hub.py", line 693, in _handle response = subscriber.callback(event) File "C:\git\Actions\AttributeChangedHandler.py", line 58, in launch manager = project.createManager(userToUse, managerType) File "c:\dev\fcp\ftrack-connect-package\.eggs\ftrack_python_legacy_api-3.6.2-py2.7.egg\FTrackCore\api\client.py", line 232, in createManager response = xmlServer.action('create', data) File "c:\dev\fcp\ftrack-connect-package\.eggs\ftrack_python_legacy_api-3.6.2-py2.7.egg\FTrackCore\api\xmlserver.py", line 300, in action response = function(data) File "c:\Python27\lib\xmlrpclib.py", line 1243, in __call__ return self.__send(self.__name, args) File "c:\Python27\lib\xmlrpclib.py", line 1596, in __request allow_none=self.__allow_none) File "c:\Python27\lib\xmlrpclib.py", line 1094, in dumps data = m.dumps(params) File "c:\Python27\lib\xmlrpclib.py", line 638, in dumps dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 660, in __dump f(self, value, write) File "c:\Python27\lib\xmlrpclib.py", line 741, in dump_struct dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 660, in __dump f(self, value, write) File "c:\Python27\lib\xmlrpclib.py", line 762, in dump_instance self.dump_struct(value.__dict__, write) File "c:\Python27\lib\xmlrpclib.py", line 741, in dump_struct dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 660, in __dump f(self, value, write) File "c:\Python27\lib\xmlrpclib.py", line 762, in dump_instance self.dump_struct(value.__dict__, write) File "c:\Python27\lib\xmlrpclib.py", line 741, in dump_struct dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 660, in __dump f(self, value, write) File "c:\Python27\lib\xmlrpclib.py", line 762, in dump_instance self.dump_struct(value.__dict__, write) File "c:\Python27\lib\xmlrpclib.py", line 741, in dump_struct dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 660, in __dump f(self, value, write) File "c:\Python27\lib\xmlrpclib.py", line 762, in dump_instance self.dump_struct(value.__dict__, write) File "c:\Python27\lib\xmlrpclib.py", line 741, in dump_struct dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 660, in __dump f(self, value, write) File "c:\Python27\lib\xmlrpclib.py", line 719, in dump_array dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 660, in __dump f(self, value, write) File "c:\Python27\lib\xmlrpclib.py", line 762, in dump_instance self.dump_struct(value.__dict__, write) File "c:\Python27\lib\xmlrpclib.py", line 741, in dump_struct dump(v, write) File "c:\Python27\lib\xmlrpclib.py", line 652, in __dump raise TypeError, "cannot marshal %s objects" % type(value) TypeError: cannot marshal <type 'file'> objects Hope, someone has an idea!? Thanks in advance! Tim Link to comment Share on other sites More sharing options...
Tim Edelmann Posted January 9, 2018 Author Report Share Posted January 9, 2018 found it out myself.. The solution was to do this: manager = project.createManager(ftrack.User(username), ftrack.ManagerType('Assistant Producer')) with ONLY using the old api!! This is nowhere to be found in the docs (sadly), so it took me 1.5 days When I try doing this with a user loaded via the new api, its crashing with the above results.. Link to comment Share on other sites More sharing options...
Mattias Lagergren Posted January 11, 2018 Report Share Posted January 11, 2018 Hi Tim, if you do not get a response here on the community forum you can always contact us through the support chat or by emailing support[at]ftrack.com Link to comment Share on other sites More sharing options...
Recommended Posts
Archived
This topic is now archived and is closed to further replies.