Skip to content

Commit 6c65c52

Browse files
committed
[ModelicaSystem.buildModel] check if model executable exists
1 parent a53d0ea commit 6c65c52

1 file changed

Lines changed: 8 additions & 1 deletion

File tree

OMPython/ModelicaSystem.py

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -433,6 +433,9 @@ def getWorkDirectory(self) -> OMCPath:
433433
return self._work_dir
434434

435435
def buildModel(self, variableFilter: Optional[str] = None):
436+
"""
437+
Build the model executable.
438+
"""
436439
if variableFilter is not None:
437440
self._variable_filter = variableFilter
438441

@@ -444,7 +447,11 @@ def buildModel(self, variableFilter: Optional[str] = None):
444447
buildModelResult = self._requestApi("buildModel", self._model_name, properties=varFilter)
445448
logger.debug("OM model build result: %s", buildModelResult)
446449

447-
xml_file = self._getconn.omcpath(buildModelResult[0]).parent / buildModelResult[1]
450+
model_executable = self._getconn.omcpath(buildModelResult[0])
451+
if not model_executable.is_file():
452+
raise ModelicaSystemError(f"Missing model executable after buildModel(): {model_executable.as_posix()}")
453+
454+
xml_file = model_executable / buildModelResult[1]
448455
self._xmlparse(xml_file=xml_file)
449456

450457
def sendExpression(self, expr: str, parsed: bool = True):

0 commit comments

Comments
 (0)