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

Revision history [back]

Error when loading openstudio model using python after v3.7

Recently updated to OpenStudio 3.7, but since then, I'm not able to load models in python the same way as before. This is the way I loaded models in python in version 3.5.1:

# Set filenames
filename = "../test.osm"
modelfilepath = openstudio.path(filename)

# Load openstudio model
optional_model = openstudio.openstudiomodel.Model.load(modelfilepath)

# # Load openstudio model using VersionTranslator
# vs = openstudio.osversion.VersionTranslator()
# optional_model = vs.loadModel(modelfilepath)

# Get optional model
if optional_model.is_initialized():
    model = optional_model.get()

But the same code in version 3.7 causes the following error:

TypeError: Wrong number or type of arguments for overloaded function 'Model_load'.
  Possible C/C++ prototypes are:
    openstudio::model::Model::load(openstudio::path const &)
    openstudio::model::Model::load(openstudio::path const &,openstudio::path const &)

I get the same results regardless of the openstudio version of the osm file I am trying to load. I did see that #4923 changed the Model::load API and was wondering if there's a different way to load models now.

Error when loading openstudio model using python after v3.7

Recently updated to OpenStudio 3.7, but since then, I'm not able to load models in python the same way as before. This is the way I loaded models in python in version 3.5.1:

# Set filenames
filename = "../test.osm"
modelfilepath = openstudio.path(filename)

# Load openstudio model
optional_model = openstudio.openstudiomodel.Model.load(modelfilepath)

# # Load openstudio model using VersionTranslator
# vs = openstudio.osversion.VersionTranslator()
# optional_model = vs.loadModel(modelfilepath)

# Get optional model
if optional_model.is_initialized():
    model = optional_model.get()

But the same code in version 3.7 causes the following error:

TypeError: Wrong number or type of arguments for overloaded function 'Model_load'.
  Possible C/C++ prototypes are:
    openstudio::model::Model::load(openstudio::path const &)
    openstudio::model::Model::load(openstudio::path const &,openstudio::path const &)

I get the same results regardless of the openstudio version of the osm file I am trying to load. I did see that #4923 changed the Model::load API and was wondering if there's a different way to load models now.