Skip to content

OMPython using getParameterValue with sendExpression in a python script #54

@Laxaeus

Description

@Laxaeus

I tried every command listed in the scripting API, everyone works except for getParameterValue:

when I type omc.sendExpression("setParameterValue(MyModel, param1, 2)") it replies: OK
(I already loaded the MyModel model first using loadModel with sendExpression)

when I type omc.sendExpression("getParameterValue(MyModel, param1)") it should reply "2" but instead it gives me a huge error:

File "", line 1, in
File "/home/user/.local/lib/python2.7/site-packages/OMPython/init.py", line 484, in sendExpression
answer = OMTypedParser.parseString(result)
File "/home/user/.local/lib/python2.7/site-packages/OMPython/OMTypedParser.py", line 109, in parseString
return omcGrammar.parseString(string)[0]
File "/home/user/.local/lib/python2.7/site-packages/pyparsing.py", line 1632, in parseString
raise exc
pyparsing.ParseException: Expected {quoted string, starting with " ending with " | Combine:({["-"] {"0" | W:(1234...,0123...)} [{"." W:(0123...)}] [{W:(eE) W:(0123...,0123...)}]}) | Forward: ... | Group:({Suppress:("{") [Forward: ... [, Forward: ...]...] Suppress:("}")}) | Group:({Suppress:("(") [Forward: ... [, Forward: ...]...] Suppress:(")")}) | {Suppress:("SOME") Suppress:("(") Forward: ... Suppress:(")")} | "true" | "false" | {"NONE" Suppress:("(") Suppress:(")")} | Combine:(Forward: ...)} (at char 1), (line:2, col:1)

Am I doing something wrong or is my installation corrupted? Because any other command from the scripting API works just fine.

Thank you.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions