Jump to content

Problem publishing component


frederickfowles

Recommended Posts

<ftrack_api.query.QueryResult object at 0x0000024562AC9CF8>
# Error: ftrack_api.session.Session : Server reported error: ValueError(Cannot set relationship to string value.) # 
# Error: Server reported error: ValueError(Cannot set relationship to string value.)
# Traceback (most recent call last):
#   File "<maya console>", line 1, in <module>
#   File "R:/Pipeline/configs/assetPipeline\assetAPI.py", line 430, in publishComponent
#     self.set_component(oVersion, filePath)
#   File "R:/Pipeline/configs/assetPipeline\assetAPI.py", line 420, in set_component
#     self.session.commit()
#   File "R:/Pipeline/APIs/ftrackAPI\ftrack_api\session.py", line 1241, in commit
#     result = self._call(batch)
#   File "R:/Pipeline/APIs/ftrackAPI\ftrack_api\session.py", line 1620, in _call
#     raise ftrack_api.exception.ServerError(error_message)
# ServerError: Server reported error: ValueError(Cannot set relationship to string value.) # 
 

 

MY CODE 

 

    def set_component(self, asset_version, filePath):
        logger.info("Publishing Component %s ---------------------------------" % filePath)
        location = self.session.query('Location where name is "ftrack.unmanaged"').one()  # This is important
        # location = self.session.query('Location where name is "{}"'.format("ftrack.unmanaged")).one()
        print asset_version
        print "FilePath: %s" % filePath
        print "Location: "
        print location
        ft_component = asset_version.create_component(path=filePath, location=location)
        self.session.commit()
        if ft_component:
            logger.info("Publishing Component Succesful %s ---------------------------------" % ft_component)
            return ft_component

    def publishComponent(self, sAsset, componentType, filePath, sTaskType="Rigging",iVersionNumber=1):
        oVersion = self.build_asset_version(sAsset, sTaskType,iVersionNumber)
        print oVersion.keys()
        if componentType in ["model", "rig"]:
            publishChecks.sanityChecks(componentType)
            self.set_component(oVersion, filePath)

    def build_asset_version(self, sAsset, sTaskType, version=0, note=''):
        '''Builds an AssetVersion, it takes an asset and a task as arguments"'''
        asset = self.getOAsset(sAsset,sTaskType)
        task = self.getOTask(sAsset,sTaskType)
        try:
            # ONLY HERE FOR DEV DELETE AFTERWARDS
            version_query = 'AssetVersion where task_id is "{}" and version is "{}" and asset.type.id is "{}"'.format(
                task['id'], int(version), asset['type']['id'])
            current_versions = self.session.query(version_query).one()
            if current_versions:
                # Deletes the old version  ^^^^^^^ DEV ONLY ^^^^^^^^
                self.session.delete(current_versions)
                self.session.commit()
        except:
            logger.info("Asset Version Creation Error %s ---------------------------------" % asset['name'])
 

 

 

Link to comment
Share on other sites

  • 2 weeks later...

Hi, could you provide a small self-contained script where you reproduce this issue? I.e. without the function calls etc, as it is hard to know exactly where the issue.

From the error message it does sound like a relationship attribute is set to a string value rather than the object. E.g. "task" or "asset" could be such relations

Link to comment
Share on other sites

Archived

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

×
×
  • Create New...