get properties in external methods
Hi, does anybody know how to access properties in External Methods? I want to get the properties and meta_type of objectId. the following script doesn't work. Any hints? -- many thanks for your replies, Elena (please answer directly to my adress so I get your reply sooner, thx) def main(self, objectId): objectType = objectId.meta_type objectSource = '' if objectType != 'folder': objectSource = objectId.read() <###### does this work with python scripts, too (for the source and parameters)? objectTitle = getattr(objectId, 'title') for prop in self.propertyIds(): if prop != 'title': propValue = getProperty(prop) propType = getPropertyType(prop) return
Elena Schulz writes:
I want to get the properties and meta_type of objectId. the following script doesn't work. Any hints? When you report problems, you should add a precise problem description, e.g. Error Type/Value and Traceback.
-- many thanks for your replies, Elena
(please answer directly to my adress so I get your reply sooner, thx)
def main(self, objectId):
objectType = objectId.meta_type This probably fails because "objectId" is likely (according to its name) a string and not the object itself.
A string does not have an attribute "meta_type". You use "getattr" to access an attribute given its name. Therefore, the following may work: objectType= getattr(self,objectId).meta_type Dieter
participants (2)
-
Dieter Maurer -
Elena Schulz