OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
any method that takes a path no longer accepts something from openstudio.toPath.
Current Behavior
Expected Behavior
something from openstudio.toPath should still work.
Steps to Reproduce
In [4]: m.save(openstudio.toPath("model.osm"), True)
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Cell In[4], line 1
----> 1 m.save(openstudio.toPath("model.osm"), True)
File ~/Virtualenvs/py39/lib/python3.9/site-packages/openstudio/openstudioutilitiesidf.py:1997, in Workspace.save(self, p, overwrite)
1996 def save(self, p, overwrite=False):
-> 1997 return _openstudioutilitiesidf.Workspace_save(self, p, overwrite)
TypeError: Wrong number or type of arguments for overloaded function 'Workspace_save'.
Possible C/C++ prototypes are:
openstudio::Workspace::save(openstudio::path const &,bool)
openstudio::Workspace::save(openstudio::path const &)
In [5]: openstudio.toPath("model.osm")
Out[5]: <openstudio.openstudioutilitiescore.path; proxy of <Swig Object of type 'openstudio::path *' at 0x115155690> >
In [6]: from pathlib import Path
In [7]: m.save(Path("model.osm"), True)
Out[7]: True
In [8]: str(openstudio.toPath("model.osm"))
Out[8]: 'model.osm'
Possible Solution
I messed up the typemap in #4917 probably.
I throroughly tested the typemaps mostly on std::filesystem and without the preexisting typemap code that was in openstudio, because I also upstreamed the change to SWIG (https://github.com/swig/swig/pull/2639) which should be in the next release of swig. I think I should align OpenStudio's on the SWIG official one.
Details
Environment
Some additional details about your environment for this issue (if relevant):
Platform (Operating system, version): all
Version of OpenStudio (if using an intermediate build, include SHA): 3.7.0
Issue overview
any method that takes a path no longer accepts something from openstudio.toPath.
Current Behavior
Expected Behavior
something from openstudio.toPath should still work.
Steps to Reproduce
Possible Solution
I messed up the typemap in #4917 probably. I throroughly tested the typemaps mostly on std::filesystem and without the preexisting typemap code that was in openstudio, because I also upstreamed the change to SWIG (https://github.com/swig/swig/pull/2639) which should be in the next release of swig. I think I should align OpenStudio's on the SWIG official one.
Details
Environment
Some additional details about your environment for this issue (if relevant):
Context
Another report: https://unmethours.com/question/97802/python-errors-with-openstudiopath/