Skip to content

alexsysctrl/hex-ant-fix

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 

Repository files navigation

hex-ant-fix

Fixes the relative import error in Mesa's hex_ant example when running with solara run.

The Problem

The hex_ant example uses relative imports:

from .agent import AntState

This breaks when running solara run app.py because Solara doesn't recognize the package context.

The Fix

Run this command in the hex_ant directory:

python fix_imports.py

It converts all relative imports to absolute imports compatible with Mesa 3.x/4.x.

What it changes

  • from .agent import AntStatefrom agent import AntState
  • from .model import HexAntModelfrom model import HexAntModel
  • from mesa.visualization import SolaraVizfrom mesa import SolaraViz (if needed)

How to revert

git checkout -- .

Credits

Created to help the Mesa community fix issue #357.

About

Fix relative imports in Mesa hex_ant example for Solara compatibility

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages