Skip to content

Commit

Permalink
add a parsed Flag in sendExpression
Browse files Browse the repository at this point in the history
  • Loading branch information
arun3688 committed Apr 29, 2016
1 parent 3494e86 commit ee3287a
Showing 1 changed file with 9 additions and 7 deletions.
16 changes: 9 additions & 7 deletions OMPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -221,7 +221,7 @@ def execute(self, command):
# FIXME: we should have one function which interacts with OMC. Either execute OR sendExpression.
# Execute uses OMParser.check_for_values and sendExpression uses OMTypedParser.parseString.
# We should have one parser. Then we can get rid of one of these functions.
def sendExpression(self, command):
def sendExpression(self, command, parsed=True):
"""
Sends an expression to the OpenModelica. The return type is parsed as if the
expression was part of the typed OpenModelica API (see ModelicaBuiltin.mo).
Expand All @@ -239,12 +239,14 @@ def sendExpression(self, command):
self._omc = None
return result
else:
try:
answer = OMTypedParser.parseString(result)
return answer
except pyparsing.ParseException as e:
print e
return result
if(parsed==True):
try:
answer = OMTypedParser.parseString(result)
return answer
except pyparsing.ParseException as e:
print e
else:
return result
else:
return "No connection with OMC. Create an instance of OMCSession."

Expand Down

0 comments on commit ee3287a

Please sign in to comment.