简体   繁体   English

高级教程可视化中的Python Mesa错误

[英]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. 我正在关注python mesa的教程( http://mesa.readthedocs.io/en/latest/index.html ),但是我无法从高级教程( http://mesa.readthedocs.io)中获得可视化效果。 /en/latest/tutorials/adv_tutorial.html )并开始运行。

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. 当我在提到的代码的最后一行中省略3个参数时,我收到3个参数丢失的错误消息。

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 我似乎遇到了同样的问题,他们说我运行了一个过时的版本,但我没有验证: 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. 无论如何,该dict变通办法可以工作。

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

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