Re: [Python.NET] TypeError: unindexable object

Denis Akhiyarov <[email protected]>
Newsgroups gmane.comp.python.dotnet
Message-ID <CALxxJLSQTwCa7RXnhWj7aM9Ka4Vv=3veknT+NJN4e40TB505OA@mail.gmail.com>
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 <[email protected]> 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.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
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.