question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

ValueError: 3794 is not a valid AbilityId

See original GitHub issue

full stacktrace

$ python3 examples/protoss/cannon_rush.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:     (2)CatalystLE
INFO:sc2.controller:Players: Bot(Race.Protoss, <__main__.CannonRushBot object at 0x10b8d28d0>, name='CheeseCannon'), Computer(Race.Protoss, 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 (CheeseCannon)
INFO:sc2.sc2process:kill_switch: Process cleanup
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
Traceback (most recent call last):
  File "examples/protoss/cannon_rush.py", line 60, in <module>
    main()
  File "examples/protoss/cannon_rush.py", line 57, in main
    ], realtime=False)
  File "/Users/wseobseo/.local/lib/python3.7/site-packages/sc2/main.py", line 306, in run_game
    _host_game(map_settings, players, **kwargs)
  File "/Users/wseobseo/anaconda3/lib/python3.7/asyncio/base_events.py", line 568, in run_until_complete
    return future.result()
  File "/Users/wseobseo/.local/lib/python3.7/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/.local/lib/python3.7/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/.local/lib/python3.7/site-packages/sc2/main.py", line 91, in _play_game_ai
    game_data = await client.get_game_data()
  File "/Users/wseobseo/.local/lib/python3.7/site-packages/sc2/client.py", line 143, in get_game_data
    return GameData(result.data)
  File "/Users/wseobseo/.local/lib/python3.7/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/.local/lib/python3.7/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/.local/lib/python3.7/site-packages/sc2/game_data.py", line 93, in __init__
    assert self.id != 0
  File "/Users/wseobseo/.local/lib/python3.7/site-packages/sc2/game_data.py", line 101, in id
    return AbilityId(self._proto.remaps_to_ability_id)
  File "/Users/wseobseo/anaconda3/lib/python3.7/enum.py", line 307, in __call__
    return cls.__new__(cls, value)
  File "/Users/wseobseo/anaconda3/lib/python3.7/enum.py", line 555, in __new__
    return cls._missing_(value)
  File "/Users/wseobseo/anaconda3/lib/python3.7/enum.py", line 568, 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 0x10c14b860>

my library versions

$ pip freeze | grep 'sc\?2'
s2clientprotocol==4.9.0.74071.0
sc2==0.11.1

Also, I use a touch bar MacBook Pro.

Could anybody help me ? thank you very much!

Issue Analytics

  • State:open
  • Created 4 years ago
  • Reactions:11
  • Comments:25

github_iconTop GitHub Comments

16reactions
BurnySc2commented, May 26, 2019

It is a total mess right now.

Things were working well until StarCraft2 version 4.8.4. In 4.8.5, the pixelmap changed and self.state.upgrades stopped working. Thus, self.already_pending_upgrade(UPGRADEID) stopped working if the upgrade was completely researched (should return 1, but returns 0 instead). self.state.upgrades was fixed in SC2 version 4.9.0.

The master branch of this library is working for SC2 version 4.8.4, while the develop branch fixed the issues with pixelmap introduced in 4.8.5 (and is the same in 4.8.6). Pixelmaps were starting in the top left but are now starting in the bottom left, so they were flipped in y-axis. Also pixelmap values changed from bytes to bits (like pathing grid, placement grid, and in 4.9.0 also creep map).

Dentosal needs a working version for his competition https://artificial-overmind.reaktor.com which runs on (I believe) 4.7.1 because it is using this linux client https://github.com/Blizzard/s2client-proto#linux-packages and the master branch works fine for that.

However in SC2 client 4.9.0 a new bug got introduced (that was already there about half a year ago in november 2018) that you can’t run 2 bots against each other, but running bot against built-in AI works (because only one SC2 client needs to run for this). So new competitions like Probots ( https://www.eschamp.com/probots-2019-2/ ) decided to also run on client version 4.8.4

TLDR: If you want to run the latest SC2 client version 4.9.0 on windows/mac: You need to download and install the develop branch (instruction here: https://github.com/Dentosal/python-sc2/issues/266 ) and go into the library installation in your python folder and do the following changes: In sc2/game_state.py you have to change self.creep: PixelMap = PixelMap(self.observation_raw.map_state.creep, mirrored=True) to self.creep: PixelMap = PixelMap(self.observation_raw.map_state.creep, in_bits=True, mirrored=True) and in sc2/game_data.py you have to remove the line assert self.id != 0.

Also you need to download generate_id_constants_from_stableid.py from here https://github.com/Dentosal/python-sc2 and let it run once (create subfolders sc2/ids first) to update the IDs that were changed once again in 4.9.0 Then copy these newly generated files into the sc2/ids/ folders of the library in your python installation.

10reactions
ocnuybearcommented, Jul 4, 2019
  1. Browse to c:\program files (x86)\microsoft visual studio\shared\python37_64\lib\site-packages\sc2 (I’m using Python in Visual Studio 2019 environment)
  2. Edit game_data.py and comment out ‘assert self.id != 0’ with # in front, save changes.
  3. Edit pixel_map.py and comment out ‘assert self.bits_per_pixel % 8 == 0, “Unsupported pixel density”’ with # in front, save changes.

Run again and game should work now fully updated on 4 Jul 2019

Read more comments on GitHub >

github_iconTop Results From Across the Web

Developers - ValueError: 3794 is not a valid AbilityId - - Bountysource
Coming soon: A brand new website interface for an even better experience!
Read more >
Starcraft starts with python-sc2 but nothing happens after the ...
1 Answer 1 ... I had the same error, the game's current version is not compactible with the modul. There is a thread...
Read more >
Issues · Dentosal/python-sc2 · GitHub
after fixing 3794/3795 error -botAI main_base_ramp fails ... ValueError: 3794 is not a valid AbilityId causing by "realtime=True/False".
Read more >
Use raw_cmd in ATX With Examples - LambdaTest
Learn how to use raw_cmd function in ATX framework for your next python automation project with LambdaTest Automation Testing Advisor.
Read more >
星际2 AI中文教程StarCraft2 AI with python-sc2/pysc2 API
ValueError : 3794 is not a valid AbilityId ... sc2.ids.ability_id import AbilityId from sc2.ids.buff_id import BuffId from sc2.ids.upgrade_id ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found