Skip to content

applying swmm toolkit fix for compatibility with SWIG>=4.3 #96

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: dev
Choose a base branch
from

Conversation

aerispaha
Copy link

This applies a modification to owa-epanet/wrapper/toolkit.i that resolves an issue that was introduced with SWIG 4.3. This is nearly identical to the fix that was applied to the SWMM toolkit here.

Without this change, swig-wrapped functions that "return None no longer implicitly return void" due to these changes. This seemingly causes functions to return a list with two elements, where the first element is None and the second element is (likely) the object intended to be returned by the function. In practice this results in TypeErrors, for example:

Traceback (most recent call last):
  File "/Users/adamerispaha/code/mws-test/tests/test_run.py", line 38, in test_run_small_inp_downloaded
    self.assertTrue(run_inp(os.path.join(MODELS_DIR, 'small.inp'), collection_interval=120*60))
  File "/Users/adamerispaha/code/mws-test/src/run.py", line 10, in run_inp
    with Network(file_path=file_path, collection_interval=collection_interval) as net:
  File "/Users/adamerispaha/code/mws-test/.venv/lib/python3.10/site-packages/epanetwrapper/network/network.py", line 76, in __enter__
    toolkit.open(self.project, self.inp_file, self.report_file, self.output_file)
  File "/Users/adamerispaha/code/mws-test/.venv/lib/python3.10/site-packages/epanet/toolkit.py", line 671, in open
    return _toolkit.open(ph, inpFile, rptFile, outFile)
TypeError: in method 'open', argument 1 of type 'EN_Project'

The changes to the owa-epanet/wrapper/toolkit.i fixes this behavior.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant