Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Unexpected behavior running Python Model Experiment #22

Open
AlABarazi opened this issue Apr 21, 2023 · 1 comment
Open

Unexpected behavior running Python Model Experiment #22

AlABarazi opened this issue Apr 21, 2023 · 1 comment

Comments

@AlABarazi
Copy link

AlABarazi commented Apr 21, 2023

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

@vilkinsons
Copy link
Member

vilkinsons commented Apr 21, 2023

See also other recent Python experiment issues: #23 and #25

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants