Skip to content

Commit

Permalink
Allow os.PathLike as path to extracted FMU in simulate_fmu() (#492)
Browse files Browse the repository at this point in the history
fixes #431
  • Loading branch information
t-sommer authored Nov 29, 2022
1 parent 19051f3 commit 7fcbb88
Show file tree
Hide file tree
Showing 2 changed files with 2 additions and 2 deletions.
2 changes: 1 addition & 1 deletion fmpy/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,7 +73,7 @@ def supported_platforms(filename: Union[str, IO]):
"""

# get the files within the FMU
if isinstance(filename, str) and os.path.isdir(filename): # extracted FMU
if isinstance(filename, (str, os.PathLike)) and os.path.isdir(filename): # extracted FMU
names = []
for dirpath, _, filenames in os.walk(filename):
for name in filenames:
Expand Down
2 changes: 1 addition & 1 deletion fmpy/model_description.py
Original file line number Diff line number Diff line change
Expand Up @@ -423,7 +423,7 @@ def read_model_description(filename: Union[str, IO], validate: bool = True, vali
# remember the original filename
_filename = filename

if isinstance(filename, str) and os.path.isdir(filename): # extracted FMU
if isinstance(filename, (str, os.PathLike)) and os.path.isdir(filename): # extracted FMU
filename = os.path.join(filename, 'modelDescription.xml')
tree = etree.parse(filename)
elif isinstance(filename, str) and os.path.isfile(filename) and filename.lower().endswith('.xml'): # XML file
Expand Down

0 comments on commit 7fcbb88

Please sign in to comment.