Python Mesa Error in advanced tutorial visualization

634 Views Asked by At

I am following the tutorial of the python mesa ( http://mesa.readthedocs.io/en/latest/index.html ) and i can't get the visualization from the advanced tutorial ( http://mesa.readthedocs.io/en/latest/tutorials/adv_tutorial.html ) up and running.

Code where I am running into trouble:

server = ModularServer(SwarmportModel, 
                   [grid], 
                   "SwarmportModel", 
                   100, 10, 10)

Error i get:

server = ModularServer(SwarmportModel, [grid], "SwarmportModel", 100, 10, 10)

TypeError: __init__() takes from 3 to 5 positional arguments but 7 were given

When i ommit the 3 arguments in last line of the code i mentioned, i get the error message that 3 arguments are missing.

server = ModularServer(SwarmportModel, [grid], "SwarmportModel",)
TypeError: __init__() missing 3 required positional arguments: 'N', 'width', and 'height'

Has anyone got any idea what I am doing wrong?

1

There are 1 best solutions below

0
On

I appear to have had the same issue and they said I ran an outdated version, which I didn't verify: https://github.com/projectmesa/mesa/issues/397

server = ModularServer(SwarmportModel, [grid], "SwarmportModel", {"N": 100, "width": 10, "height": 10})

In any case the dict workaround works.