[Python.NET] TypeError: unindexable object
Rog F <[email protected]>
| Newsgroups | gmane.comp.python.dotnet |
|---|---|
| Message-ID | <AM2PR09MB046779D7B4B358635F74785D96AF0@AM2PR09MB0467.eurprd09.prod.outlook.com> |
Hello,
I'm trying to set an object property based on an indexer as described in the C# example here: https://msdn.microsoft.com/en-us/library/hh964567.aspx, but both examples fail with "TypeError: unindexable object"
Python code looks like this:
criteria = ManagementPackClassCriteria("Name = 'Microsoft.Windows.Computer'")
classes = mg.EntityTypes.GetClasses(criteria)
CIClass = classes[0]
instance = CreatableEnterpriseManagementObject(mg, CIClass)
print "instance: "+str(instance) # this isnt None
mprop = CIClass["PrincipalName"]
instance[mprop].Value = "foo"
C# .NET equivalent would be something like this:
ManagementPackClass CIClass = mp.GetClass("Microsoft.Windows.Computer");
ManagementPackProperty mprop = CIClass["PrincipalName"];
instance[mprop].Value = "foo";
Error appears to be thrown in pythonnet classobject.cs (https://github.com/pythonnet/pythonnet/blob/master/src/runtime/classobject.cs#L174)
Are there any back doors through pythonnet/System.Runtime.something that i can use to get around this? Works fine with IronPython, however i cant package up & use AWS boto3 library with IronPython which i also need (but can with py2exe + pythonnet) - so ideally want to use pythonnet.
Thanks!
Roger
_________________________________________________
Python.NET mailing list - [email protected]
https://mail.python.org/mailman/listinfo/pythondotnet