Navigation Menu

Skip to content

Instantly share code, notes, and snippets.

Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wontheone1/d645a90788a129e08fae84d54a3c5401 to your computer and use it in GitHub Desktop.
Save wontheone1/d645a90788a129e08fae84d54a3c5401 to your computer and use it in GitHub Desktop.
Run locally error
$ python3 run_locally.py
err = 3 /opt/blizzard/buildserver/data.noindex/repositories/sc2/branches/SC2.4.9/Game/Contrib/macteam/libs/ClampCursor/Contrib/mach_override/mach_override.c:244
err = 3 /opt/blizzard/buildserver/data.noindex/repositories/sc2/branches/SC2.4.9/Game/Contrib/macteam/libs/ClampCursor/Contrib/mach_override/mach_override.c:258
err = 3 /opt/blizzard/buildserver/data.noindex/repositories/sc2/branches/SC2.4.9/Game/Contrib/macteam/libs/ClampCursor/Contrib/mach_override/mach_override.c:263
INFO:sc2.protocol:Client status changed to Status.launched (was None)
INFO:sc2.controller:Creating new game
INFO:sc2.controller:Map: AbyssalReefLE
INFO:sc2.controller:Players: Bot(Race.Random, <bot.main.MyBot object at 0x10c106438>), Computer(Race.Random, Difficulty.Medium)
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 id: 1 (None)
INFO:sc2.sc2process:kill_switch: Process cleanup
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
Traceback (most recent call last):
File "run_locally.py", line 20, in <module>
main()
File "run_locally.py", line 17, in main
], realtime=False, step_time_limit=2.0, game_time_limit=(60*20), save_replay_as="test.SC2Replay")
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/main.py", line 306, in run_game
_host_game(map_settings, players, **kwargs)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/asyncio/base_events.py", line 573, in run_until_complete
return future.result()
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/main.py", line 233, in _host_game
result = await _play_game(players[0], client, realtime, portconfig, step_time_limit, game_time_limit, rgb_render_config)
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/main.py", line 204, in _play_game
result = await _play_game_ai(client, player_id, player.ai, realtime, step_time_limit, game_time_limit)
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/main.py", line 91, in _play_game_ai
game_data = await client.get_game_data()
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/client.py", line 143, in get_game_data
return GameData(result.data)
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/game_data.py", line 29, in __init__
self.abilities = {a.ability_id: AbilityData(self, a) for a in data.abilities if a.ability_id in ids}
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/game_data.py", line 29, in <dictcomp>
self.abilities = {a.ability_id: AbilityData(self, a) for a in data.abilities if a.ability_id in ids}
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/game_data.py", line 93, in __init__
assert self.id != 0
File "/Users/wseobseo/Library/Python/3.7/lib/python/site-packages/sc2/game_data.py", line 101, in id
return AbilityId(self._proto.remaps_to_ability_id)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/enum.py", line 309, in __call__
return cls.__new__(cls, value)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/enum.py", line 543, in __new__
return cls._missing_(value)
File "/usr/local/Cellar/python/3.7.1/Frameworks/Python.framework/Versions/3.7/lib/python3.7/enum.py", line 556, in _missing_
raise ValueError("%r is not a valid %s" % (value, cls.__name__))
ValueError: 3794 is not a valid AbilityId
ERROR:asyncio:Unclosed client session
client_session: <aiohttp.client.ClientSession object at 0x10c99e160>
@wontheone1
Copy link
Author

My MyBot class is just as default (only uncommented). In main.py

import json
from pathlib import Path

import sc2

# Bots are created as classes and they need to have on_step method defined.
# Do not change the name of the class!
class MyBot(sc2.BotAI):
    with open(Path(__file__).parent / "../botinfo.json") as f:
        NAME = json.load(f)["name"]

    # On_step method is invoked each game-tick and should not take more than
    # 2 seconds to run, otherwise the bot will timeout and cannot receive new
    # orders.
    # It is important to note that on_step is asynchronous - meaning practices
    # for asynchronous programming should be followed.
    async def on_step(self, iteration):
        if iteration == 0:
            await self.chat_send(f"Name: {self.NAME}")
            actions = []
            for worker in self.workers:
                actions.append(worker.attack(self.enemy_start_locations[0]))
            await self.do_actions(actions)

@wontheone1
Copy link
Author

I didn't change run_locally.py and botinfo.json file at all.

@quangdung
Copy link

I have the same error..

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