Skip to content
Closed
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Next Next commit
add flag parsed=true for sendExpression
  • Loading branch information
arun3688 committed Apr 11, 2016
commit 5296fe8d2ed9ccac2f73964573895fc8f80fb22d
12 changes: 8 additions & 4 deletions OMPython/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -57,6 +57,7 @@
import time
import logging
import uuid
import getpass
import subprocess
import tempfile
import pyparsing
Expand Down Expand Up @@ -182,7 +183,7 @@ def __init__(self, readonly=False):
if sys.platform == 'win32':
self._omc_log_file = open(os.path.join(self._temp_dir, "openmodelica.objid." + self._random_string+".log"), 'w')
else:
self._currentUser = os.environ['USER']
self._currentUser = getpass.getuser()
if not self._currentUser:
self._currentUser = "nobody"
# this file must be closed in the destructor
Expand Down Expand Up @@ -220,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 @@ -238,8 +239,11 @@ def sendExpression(self, command):
self._omc = None
return result
else:
answer = OMTypedParser.parseString(result)
return answer
if (parsed==True):
answer = OMTypedParser.parseString(result)
return answer
else:
return result
else:
return "No connection with OMC. Create an instance of OMCSession."

Expand Down