Opened 6 years ago

Last modified 3 years ago

#5230 new defect

getErrorString raises pyparsing.ParseException after calling buildModel in the python interface

Reported by: robert.mueller@… Owned by: Alachew Mengist
Priority: normal Milestone:
Component: OMPython Version: v1.13.0-dev-nightly
Keywords: buildModel getErrorString Cc: leo.gall@…

Description

Hello,

to retrieve information about the translation process, we need to call getErrorString() after calling buildModel().

In the OMSHell this works just fine by executing buildModel(Modelica.Blocks.Examples.PID_Controller);getErrorString()

Using the python interface (v1.13.0-dev-1098-ge7d386dfb (64-bit)), the following minimal working example leads to pyparsing.ParseException: Expected end of text (at char 123), (line:2, col:1):

import sys

sys.path.insert(0, r'C:\OpenModelica1.13.0-dev-64bit\share\omc\scripts\PythonInterface')
sys.path.insert(0, r'C:\OpenModelica1.13.0-dev-64bit\lib\python')

import omniORB
import OMPython

interface = OMPython.OMCSession()
print(interface.sendExpression("buildModel(Modelica.Blocks.Examples.PID_Controller);getErrorString()"))

If I instead send the command print(interface.sendExpression("buildModel(Modelica.Blocks.Examples.PID_Controller);getErrorString()")) (added a semicolon after getErrorString(), I get 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 0), (line:1, col:1) instead.

Is this reproducible? Any tips or workarounds are welcome, thank you!

Change History (9)

comment:1 by Adrian Pop, 6 years ago

I thought you don't need to call getErrorString in the python interface, it will be called automatically after each API command.

comment:2 by robert.mueller@…, 6 years ago

That would be great! But I don't know how to access the error string. If I just call interface.sendExpression("buildModel(Modelica.Blocks.Examples.PID_Controller)"), it only returns the tuple ('C:/tmp/Modelica.Blocks.Examples.PID_Controller', 'Modelica.Blocks.Examples.PID_Controller_init.xml').
Or am I missing the obvious here?

comment:3 by robert.mueller@…, 6 years ago

I imagine there is not a lot of time for fixing minor issues like this with the 1.14 release, but is there at least a known workaround? thank you for looking into it! :)

comment:4 by Francesco Casella, 6 years ago

Milestone: Future1.14.0

We can give it a try

comment:5 by robert.mueller@…, 6 years ago

Hello, I was wondering if there are any news on the topic?

comment:6 by Francesco Casella, 5 years ago

Milestone: 1.14.01.16.0

Releasing 1.14.0 which is stable and has many improvements w.r.t. 1.13.2. This issue is rescheduled to 1.16.0

comment:7 by Francesco Casella, 4 years ago

Milestone: 1.16.01.17.0

Retargeted to 1.17.0 after 1.16.0 release

comment:8 by Francesco Casella, 4 years ago

Milestone: 1.17.01.18.0

Retargeted to 1.18.0 because of 1.17.0 timed release.

comment:9 by Francesco Casella, 3 years ago

Milestone: 1.18.0

Ticket retargeted after milestone closed

Note: See TracTickets for help on using tickets.