NREL / OpenStudio

OpenStudio is a cross-platform collection of software tools to support whole building energy modeling using EnergyPlus and advanced daylight analysis using Radiance.
https://www.openstudio.net/
Other
496 stars 190 forks source link

Conversion to/from pathlib.Path in python bindings now rejects openstudio.Path #5133

Closed jmarrec closed 5 months ago

jmarrec commented 6 months ago

Issue overview

I messed something up in https://github.com/NREL/OpenStudio/pull/4917

Current Behavior

openstudio.Path is not accepted anymore in python bindings.

Expected Behavior

Steps to Reproduce

In [1]: from pathlib import Path

In [2]: import openstudio

In [4]: 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

In [7]: m.save(openstudio.toPath('model.osm'), True)
---------------------------------------------------------------------------
TypeError                                 Traceback (most recent call last)
Cell In[7], 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 &)

Possible Solution

Details

Environment

Some additional details about your environment for this issue (if relevant):

Context

https://unmethours.com/question/98612/why-does-modelsavepath-fail-with-path-an-openstudiopath/