Skip to content

Commit e0bc792

Browse files
committed
[OMCSessionBase] fix exception handling for pyparsing.ParseException
* fix ex.message => ex.msg
1 parent 7c5be8c commit e0bc792

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

OMPython/OMCSession.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -194,7 +194,7 @@ def getClassComment(self, className):
194194
return self.ask('getClassComment', className)
195195
except pyparsing.ParseException as ex:
196196
logger.warning("Method 'getClassComment' failed for %s", className)
197-
logger.warning('OMTypedParser error: %s', ex.message)
197+
logger.warning('OMTypedParser error: %s', ex.msg)
198198
return 'No description available'
199199

200200
def getNthComponent(self, className, comp_id):
@@ -229,7 +229,7 @@ def getParameterValue(self, className, parameterName):
229229
try:
230230
return self.ask('getParameterValue', f'{className}, {parameterName}')
231231
except pyparsing.ParseException as ex:
232-
logger.warning('OMTypedParser error: %s', ex.message)
232+
logger.warning('OMTypedParser error: %s', ex.msg)
233233
return ""
234234

235235
def getComponentModifierNames(self, className, componentName):
@@ -240,7 +240,7 @@ def getComponentModifierValue(self, className, componentName):
240240
# FIXME: OMPython exception UnboundLocalError exception for 'Modelica.Fluid.Machines.ControlledPump'
241241
return self.ask('getComponentModifierValue', f'{className}, {componentName}')
242242
except pyparsing.ParseException as ex:
243-
logger.warning('OMTypedParser error: %s', ex.message)
243+
logger.warning('OMTypedParser error: %s', ex.msg)
244244
result = self.ask('getComponentModifierValue', f'{className}, {componentName}', parsed=False)
245245
try:
246246
answer = om_parser_basic(result)
@@ -257,7 +257,7 @@ def getExtendsModifierValue(self, className, extendsName, modifierName):
257257
# FIXME: OMPython exception UnboundLocalError exception for 'Modelica.Fluid.Machines.ControlledPump'
258258
return self.ask('getExtendsModifierValue', f'{className}, {extendsName}, {modifierName}')
259259
except pyparsing.ParseException as ex:
260-
logger.warning('OMTypedParser error: %s', ex.message)
260+
logger.warning('OMTypedParser error: %s', ex.msg)
261261
result = self.ask('getExtendsModifierValue', f'{className}, {extendsName}, {modifierName}', parsed=False)
262262
try:
263263
answer = om_parser_basic(result)

0 commit comments

Comments
 (0)