Can you include full traceback with debug build of pythonnet from develop branch on GitHub? Also please log this issue to github. On Thursday, February 18, 2016, Rog F <r_foskett@hotmail.com> wrote:
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.c...)
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