Error when loading openstudio model using python after v3.7 [closed]

asked 2024-06-05 14:57:46 -0500

updated 2024-06-06 08:45:20 -0500

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.

edit retag flag offensive reopen merge delete

Closed for the following reason duplicate question by Ken Takahashi
close date 2024-06-06 11:14:03.166401

Comments

1

I think this is the same issue as this?

shorowit's avatar shorowit  ( 2024-06-06 11:00:12 -0500 )edit

Oh yes that most certainly was the issue! Did not think to check if the path object was not working. Thank you very much!

Ken Takahashi's avatar Ken Takahashi  ( 2024-06-06 11:13:43 -0500 )edit

Fixed in 3.8.0 FYI.

Julien Marrec's avatar Julien Marrec  ( 2024-06-07 02:36:28 -0500 )edit