abce icon indicating copy to clipboard operation
abce copied to clipboard

Issue when running jupyter example

Open Sirorezka opened this issue 6 years ago • 1 comments

When running jupyter example the code breaks. I'm running the following code:

import abce

simulation = abce.Simulation(name="ipythonsimulation", processes=1)

class Agent(abce.Agent):
    def init(self, parameters, agent_parameters):
        self.family_name = agent_parameters
        self.world_size = parameters['world_size']
    def say(self):
        print("hello I am %s my id %i and my group is '%s', it is the %i round" % (self.family_name, self.id, self.group, self.round))

agents = simulation.build_agents(Agent, 'agent', 
                                parameters={"world_size": 10}, 
                                agent_parameters=['fred', 'astaire', 'altair', 'deurich'])

I get the following error:

TypeError: string indices must be integers

in

singleprocess.py

agent.init(**ChainMap(simulation_parameters,ap))

Sirorezka avatar Aug 28 '18 07:08 Sirorezka

@Sirorezka Is the error still present? I tried running the jupyter tutorial on the latest master (as of this comment, https://github.com/AB-CE/abce/commit/683c674df4df4e92dd66e21c0000d40e9c2c3798) and I was able build the agents just fine.

rht avatar Oct 20 '19 20:10 rht