First time here? Check out the Help page!
1 | initial version |
Sorry for the trouble, I added a conversion to/from openstudio.Path
to python's `pathlib.Path, and messed something up.
Basically this comes from (an honestly good) intention, which was to allow seemless conversion to/from pathlib.Path
but it seems it does have the side effect that it rejects an openstudio.Path
now.
You might have noticed that anything returning an openstudio::path
now converts to a pathlib.Path
In [1]: osw = openstudio.WorkflowJSON()
In [2]: osw.absoluteRootDir()
Out[2]: PosixPath('......')
Similarly you can pass a pathlib.Path to something taking an openstudio::Path. Or a string.
In [1]: from pathlib import Path
import openstudio
m = openstudio.model.Model()
In [5]: m.save('model.osm', True)
Out[5]: True
In [6]: m.save(Path('model.osm'), True)
Out[6]: True
Bottom line, use a python string
or a pathtlib.Path
. Use str(the_path)
if you don't know what you're getting in.
I filed it at NREL/OpenStudio#5133
2 | No.2 Revision |
Sorry for the trouble, I added a conversion to/from openstudio.Path
to python's `pathlib.Path, pathlib.Path
, and apprently messed something up.
Basically this comes from (an honestly good) intention, which was to allow seemless conversion to/from pathlib.Path
but it seems it does have the side effect that it rejects an openstudio.Path
now.
You might have noticed that anything returning an openstudio::path
now converts to a pathlib.Path
In [1]: osw = openstudio.WorkflowJSON()
In [2]: osw.absoluteRootDir()
Out[2]: PosixPath('......')
Similarly you can pass a pathlib.Path to something taking an openstudio::Path. Or a string.
In [1]: from pathlib import Path
import openstudio
m = openstudio.model.Model()
In [5]: m.save('model.osm', True)
Out[5]: True
In [6]: m.save(Path('model.osm'), True)
Out[6]: True
Bottom line, use a python string
or a pathtlib.Path
. Use str(the_path)
if you don't know what you're getting in.
I filed it at NREL/OpenStudio#5133
Please note that such changes may be unexpected (I mean such as returning a pathlib.Path, not breaking existing workflows), but support for Python Measures was not effective before so it was a more than appropriate time to perform usability-related API breaks before we got stuck with the status quo.