[Ironpython-users] Scripting Ansys with IronPython - Unable to call values from dictionary

Ossi Heinonen ossi.heinonen at tut.fi
Fri Nov 25 09:39:52 CET 2011


On 25.11.2011 10:30, Jeff Hardy wrote:
> On Thu, Nov 24, 2011 at 11:12 PM, Ossi Heinonen<ossi.heinonen at tut.fi>  wrote:
>> Hi again
>>
>> Could it be possible to use some sort of wildcard method in this one? Like
>>
>>     verifiedValues['*P1*']
>>
>> or
>>
>>     verifiedValues['?P1?']
>>
>> Just a thought that seems intuitive, but is it doable?
> No, that won't work with a plain Python dict (it could be made to work
> on a custom object, but that doesn't appear to be what you have here).
>
> Actually, you probably have a .NET dictionary (which is shown as dict,
> confusingly) - the question is whether it's generic or not. Can you
> try calling verifiedValues.GetType()?
>
> Also, is there a reason you're using 2.6? I believe 2.7 has some fixes
> around generics, so that may be necessary.
>
> - Jeff

Hi Jeff

GetType gives me

     verifiedValues.GetType()
<System.RuntimeType object at 0x000000000000002B 
[IronPython.Runtime.PythonDictionary]>

I'm using the Ansys Workbench Command Window which seems to be running 
on IronPython 2.6. If you think it will be necessary to use a newer 
version, I'll try to check if that's possible.

- Ossi


More information about the Ironpython-users mailing list