You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
AttributeError: 'MyBot' object has no attribute 'larva'
The implementation:
Took from the example from the site:
importrandomfromsc2importmapsfromsc2.bot_aiimportBotAIfromsc2.dataimportDifficulty, Racefromsc2.ids.ability_idimportAbilityIdfromsc2.ids.unit_typeidimportUnitTypeIdfromsc2.ids.upgrade_idimportUpgradeIdfromsc2.mainimportrun_gamefromsc2.playerimportBot, Computerfromsc2.positionimportPoint2fromsc2.unitimportUnitfromsc2.unitsimportUnitsMAP_TO_PLAY="BlackburnAIE"importsc2fromsc2.bot_aiimportBotAIfromsc2.playerimportBot, ComputerclassMyBot(BotAI):
asyncdefon_step(self, iteration: int):
print(f"This is my bot in iteration {iteration}!")
self.larva# only this addedsc2.run_game(
sc2.maps.get(MAP_TO_PLAY),
[Bot(sc2.Race.Zerg, MyBot()), Computer(sc2.Race.Zerg, sc2.Difficulty.Hard)],
realtime=False,
)
Logs:
➜ sc2-bot git:(master) ✗ /usr/local/opt/python@3.9/bin/python3.9 hydralisk_push.py
INFO:sc2.protocol:Client status changed to Status.launched (was None)
INFO:sc2.controller:Creating new game
INFO:sc2.controller:Map: BlackburnAIE
INFO:sc2.controller:Players: Bot(Race.Zerg, <__main__.MyBot object at 0x1069bb580>), Computer Hard(Zerg, RandomBuild)
INFO:sc2.protocol:Client status changed to Status.init_game (was Status.launched)
INFO:sc2.protocol:Client status changed to Status.in_game (was None)
INFO:root:Player 1 - Bot(Race.Zerg, <__main__.MyBot object at 0x1069bb580>)
This is my bot in iteration 0!
ERROR:sc2.main:AI step threw an error
Traceback (most recent call last):
File "/Users/sergeykorsik/Library/Python/3.9/lib/python/site-packages/sc2/main.py", line 150, in _play_game_ai
await ai.on_step(iteration)
File "/Users/sergeykorsik/programming/sc2-bot/hydralisk_push.py", line 24, in on_step
self.larva
AttributeError: 'MyBot' object has no attribute 'larva'
ERROR:sc2.main:resigning due to previous error
INFO:root:Result for player 1 - Bot(Race.Zerg, <__main__.MyBot object at 0x1069bb580>): Defeat
INFO:sc2.protocol:Client status changed to Status.launched (was Status.in_game)
INFO:sc2.protocol:Client status changed to Status.quit (was Status.launched)
INFO:sc2.sc2process:kill_switch: Process cleanup
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
The text was updated successfully, but these errors were encountered:
Do you remember the command you used to install the library?
Maybe you accidently ran pip install sc2 instead of pip install burnysc2 and installed this library instead? They use the same site-packages folders, so they overwrite each other.
Try pip freeze to check for installed packages.
If this is the case, you can run pip uninstall sc2 and pip install burnysc2
Overview
Always getting such errors
The implementation:
Took from the example from the site:
Logs:
The text was updated successfully, but these errors were encountered: