Skip to content

Unexpected behavior running Python Model Experiment #22

Open
@AlABarazi

Description

@AlABarazi

Describe the bug

Whenever I run a Python model which loop over neighbours as an experiment I get an error. The simulation run normally otherwise (normal run)

For example in the simulation https://core.hash.ai/@alaabarazi/actorexperiment/main
I am getting the error

2023-04-21 11:20:56
ERROR simulation: Error with 5 steps taken: Simulation error: Simulation (id: 644247393f4b1a91f8f31cc1) failed with error: Unique("Error in behavior worker_adding_value.py in the Python runtime:\n<class 'TypeError'>: string indices must be integers")

The cause of this error is the line ( if neighbor["steps_needed1"][task_key] > 0 and neighbor["position"]==state["position"] and state["status"] in act_at_work_place:)
When I comment this line the experiment works.

  for neighbor in context.neighbors():
      if neighbor["agent_name"] == state["system"]:
        if state["task"] :
          task_key = state["task"]["prev_delivery_key"]
          if neighbor["steps_needed1"][task_key] > 0 and neighbor["position"]==state["position"] and state["status"] in act_at_work_place:

Any clue what causes this. ?

To reproduce

go to. https://core.hash.ai/@alaabarazi/actorexperiment/main
run the experiment ex
wait for some time
An error message pop up
2023-04-21 11:20:56
ERROR simulation: Error with 5 steps taken: Simulation error: Simulation (id: 644247393f4b1a91f8f31cc1) failed with error: Unique("Error in behavior worker_adding_value.py in the Python runtime:\n<class 'TypeError'>: string indices must be integers")

Expected behavior

Experiment should run without errors

Project URL

https://core.hash.ai/@alaabarazi/actorexperiment/main

Device

Macbook Pro 2,6 GHz 6-Core Intel Core i7

Operating system

Macos 13.3.1 (22E261)

Browser

Version 112.0.5615.121 (Official Build) (x86_64)

Additional context

No response

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions