@@ -1603,7 +1603,7 @@ def convertMo2Fmu(
16031603 fmuType : str = "me_cs" ,
16041604 fileNamePrefix : Optional [str ] = None ,
16051605 includeResources : bool = True ,
1606- ) -> str :
1606+ ) -> pathlib . Path :
16071607 """Translate the model into a Functional Mockup Unit.
16081608
16091609 Args:
@@ -1629,15 +1629,19 @@ def convertMo2Fmu(
16291629 properties = (f'version="{ version } ", fmuType="{ fmuType } ", '
16301630 f'fileNamePrefix="{ fileNamePrefix } ", includeResources={ includeResourcesStr } ' )
16311631 fmu = self ._requestApi (apiName = 'buildModelFMU' , entity = self ._model_name , properties = properties )
1632+ fmu_path = pathlib .Path (fmu )
16321633
16331634 # report proper error message
1634- if not os . path . exists ( fmu ):
1635- raise ModelicaSystemError (f"Missing FMU file: { fmu } " )
1635+ if not fmu_path . is_file ( ):
1636+ raise ModelicaSystemError (f"Missing FMU file: { fmu . as_posix () } " )
16361637
1637- return fmu
1638+ return fmu_path
16381639
16391640 # to convert FMU to Modelica model
1640- def convertFmu2Mo (self , fmuName ): # 20
1641+ def convertFmu2Mo (
1642+ self ,
1643+ fmuName : os .PathLike ,
1644+ ) -> pathlib .Path :
16411645 """
16421646 In order to load FMU, at first it needs to be translated into Modelica model. This method is used to generate
16431647 Modelica model from the given FMU. It generates "fmuName_me_FMU.mo".
@@ -1646,13 +1650,16 @@ def convertFmu2Mo(self, fmuName): # 20
16461650 >>> convertFmu2Mo("c:/BouncingBall.Fmu")
16471651 """
16481652
1649- fileName = self ._requestApi (apiName = 'importFMU' , entity = fmuName )
1653+ fmu_path = pathlib .Path (fmuName )
1654+
1655+ filename = self ._requestApi (apiName = 'importFMU' , entity = fmu_path .as_posix ())
1656+ filepath = pathlib .Path (filename )
16501657
16511658 # report proper error message
1652- if not os . path . exists ( fileName ):
1653- raise ModelicaSystemError (f"Missing file { fileName } " )
1659+ if not filepath . is_file ( ):
1660+ raise ModelicaSystemError (f"Missing file { filepath . as_posix () } " )
16541661
1655- return fileName
1662+ return filepath
16561663
16571664 def optimize (self ) -> dict [str , Any ]:
16581665 """Perform model-based optimization.
0 commit comments