Welcome to WEAP's Website WEAP
WEAP is an initiative of the Stockholm Environment Institute.


About WEAP

Home
Why WEAP?
Features
What's New?
Sample Screens
Demonstration
Publications
History and Credits

Using WEAP
Download
Licensing
User Guide
Tutorial
Videos (YouTube)

User Forum
Discussions
Members List
Edit Profile

Additional Support
Training
University Courses
Collaboration

About Us
SEI-US Water Resources Program
Please Contact Us

LEAP
Interested in Energy?
Read about LEAP: SEI's software for energy planning.

Link WEAP and LEAP for combined Water-Energy planning.
Watch a video demo!
   

User Forum

All Topics | Topic "API problem"
Log in to post new messages or reply to existing messages.
 
Author Message
Mr. Fernando Montejo

Subject: API problem   
Posted: 8/7/2025 Viewed: 281 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"