-
-
Notifications
You must be signed in to change notification settings - Fork 1.3k
TyperError when model reporter is a partial function #1871
Copy link
Copy link
Description
Describe the bug
$ python3 scripts/run.py --campus ub
Traceback (most recent call last):
File "/Users/boyu/GitHubProjects/mesa-examples/gis/agents_and_networks/scripts/run.py", line 57, in <module>
server = mesa.visualization.ModularServer(
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/boyu/GitHubProjects/mesa-examples/venv/lib/python3.11/site-packages/mesa/visualization/ModularVisualization.py", line 355, in __init__
self.reset_model()
File "/Users/boyu/GitHubProjects/mesa-examples/venv/lib/python3.11/site-packages/mesa/visualization/ModularVisualization.py", line 382, in reset_model
self.model = self.model_cls(**model_params)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/boyu/GitHubProjects/mesa-examples/gis/agents_and_networks/src/model/model.py", line 127, in __init__
self.datacollector.collect(self)
File "/Users/boyu/GitHubProjects/mesa-examples/venv/lib/python3.11/site-packages/mesa/datacollection.py", line 182, in collect
self.model_vars[var].append(reporter())
^^^^^^^^^^
TypeError: get_num_commuters_by_status() missing 1 required positional argument: 'model'Expected behavior
The example model is expected to run without errors.
To Reproduce
Run the https://github.com/projectmesa/mesa-examples/tree/main/gis/agents_and_networks example model with latest Mesa, Mesa-Geo and Mesa-Viz-Tornado
Additional context
In the example model, the model reporters are partial functions:
But the support for partial functions was dropped in 64ce416 while dealing with attribute strings.
As a result, when partial functions are used, they are added in this way:
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels