Skip to content

Attribute error: 'int' object has no attribute 'step' #2

@nmimunro

Description

@nmimunro

I am trying to run the Session 11 tutorial. I have copied all the code across and it seems to work fine for each stage of the model until I get to the run stage. I run it using the following commands:

model = SugarscapeG1mt()
model.run_model(step_count=1)

I get a warning message as follows:
0
C:\Users\nmm9b\AppData\Local\Temp\ipykernel_25528\2571079642.py:82: DeprecationWarning: Because of the shift to using AgentSet, in the future this attribute will return a dict withtype as key as AgentSet as value. Future behavior is available via RandomActivationByType._agents_by_type
for sugar in self.schedule.agents_by_type[Sugar].values():

And I get an Attribute error as follows:
{
"name": "AttributeError",
"message": "'int' object has no attribute 'step'",
"stack": "---------------------------------------------------------------------------
AttributeError Traceback (most recent call last)
Cell In[94], line 2
1 model = SugarscapeG1mt()
----> 2 model.run_model(step_count=1)

Cell In[89], line 95, in SugarscapeG1mt.run_model(self, step_count)
93 for i in range(step_count):
94 print(i)
---> 95 self.step()

Cell In[89], line 83, in SugarscapeG1mt.step(self)
81 # step Sugar agents
82 for sugar in self.schedule.agents_by_type[Sugar].values():
---> 83 sugar.step()
85 # step Spice agents
86 for spice in self.schedule.agents_by_type[Spice].values():

AttributeError: 'int' object has no attribute 'step'"
}

The Python version I am using is 3.12.1.

What could be the source of these error messages?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions