简体   繁体   中英

Python Mesa Error in advanced tutorial visualization

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?

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.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM