All Topics | Topic: “API problem”
Author Message
Mr. Fernando Montejo
Subject: API problem   
Posted: 8/7/2025 Viewed: 4312 times

Hi,

I am trying to use the WEAP API with Python to run an optimization algorithm, however, the WEAP model is showing me this error:

WEAP.Calculate(AlwaysCalculate=False, NumWorkers=1)
File "C:\Users\User\AppData\Local\Programs\Python\Python312\Lib\site-packages\win32com\gen_py\2E3AA78D-14EC-4566-A7A3-7DC047623CD0x1033x1x0\IWEAPApplication.py", line 97, in Calculate
return self._oleobj_.InvokeTypes(205, LCID, 1, (24, 0), ((3, 49), (3, 49), (11, 49), (11, 49), (3, 49)),LastYear
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
pywintypes.com_error: (-2147352567, 'Exception occurred.', (0, 'WEAP.WEAPApplication', 'Cannot modify a read-only dataset', None, 0, -2147418113), None)

It works for a few iterations and crash.

Does anybody knows why?

Greetings
Topic: “API problem”