Question-and-Answer Resource for the Building Energy Modeling Community
Get started with the Help page
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

Why does model.save(path) fail with path an openstudio.path()?

I just upgraded from openstudio-3.6.0 SDK to opnstudio-3.7.0 SDK in Python. The following simple test used to work in 3.6.0:

import openstudio
model = openstudio.model.Model()
path = openstudio.path("./ModelTest.osm")
model.save(path)

However, in 3.7.0, I receive he following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python-3.10.11\lib\site-packages\openstudio\openstudioutilitiesidf.py", line 1997, in save
    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 &)

Interestingly, the following does seem to work instead, namely using a simple Python String instead of an OpenStudio Path:

import openstudio
model = openstudio.model.Model()
path = "./ModelTest.osm"
model.save(path)

Is there some type incompatibility going on? A "pip freeze" does confirm that I am using openstudio-3.7.0 in my Python-3.10.11.

Why does model.save(path) fail with path an openstudio.path()?

I just upgraded from openstudio-3.6.0 SDK to opnstudio-3.7.0 SDK in Python. The following simple test used to work in 3.6.0:

import openstudio
model = openstudio.model.Model()
path = openstudio.path("./ModelTest.osm")
model.save(path)

However, in 3.7.0, I receive he the following error:

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "D:\Python-3.10.11\lib\site-packages\openstudio\openstudioutilitiesidf.py", line 1997, in save
    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 &)

Interestingly, the following does seem to work instead, namely using a simple Python String instead of an OpenStudio Path:

import openstudio
model = openstudio.model.Model()
path = "./ModelTest.osm"
model.save(path)

Is there some type incompatibility going on? A "pip freeze" does confirm that I am using openstudio-3.7.0 in my Python-3.10.11.