Skip to content

Commit f179b0d

Browse files
committed
[ModelicaSystem] replace pathlib by OMCPath
1 parent e7dc621 commit f179b0d

File tree

1 file changed

+6
-3
lines changed

1 file changed

+6
-3
lines changed

OMPython/ModelicaSystem.py

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1603,7 +1603,7 @@ def convertMo2Fmu(
16031603
fmuType: str = "me_cs",
16041604
fileNamePrefix: Optional[str] = None,
16051605
includeResources: bool = True,
1606-
) -> pathlib.Path:
1606+
) -> OMCPath:
16071607
"""Translate the model into a Functional Mockup Unit.
16081608
16091609
Args:
@@ -1642,7 +1642,7 @@ def convertMo2Fmu(
16421642
def convertFmu2Mo(
16431643
self,
16441644
fmu: os.PathLike,
1645-
) -> pathlib.Path:
1645+
) -> OMCPath:
16461646
"""
16471647
In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
16481648
Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -1651,7 +1651,10 @@ def convertFmu2Mo(
16511651
>>> convertFmu2Mo("c:/BouncingBall.Fmu")
16521652
"""
16531653

1654-
fmu_path = pathlib.Path(fmu)
1654+
fmu_path = self._getconn.omcpath(fmu)
1655+
1656+
if not fmu_path.is_file():
1657+
raise ModelicaSystemError(f"Missing FMU file: {fmu_path.as_posix()}")
16551658

16561659
filename = self._requestApi(apiName='importFMU', entity=fmu_path.as_posix())
16571660
filepath = self._work_dir / filename

0 commit comments

Comments
 (0)