Error getting race letter for race-less player
Nobody has claimed this yet.
Assessment
- Difficulty
- 2/5
- Estimated time
- 1-3 hours
- Newbie friendliness
- 72/100
Research direction
Start in sc2reader/objects.py at Team.lineup, specifically the play_race indexing shown in the traceback. Reproduce the failure with the attached Impossible Cyrus (87).SC2Replay and inspect how the neutral CPU player is represented. Done means sc2printer.py can process that replay without an IndexError while preserving lineup generation for players with races.
Written by the indexing model from the issue text.
Description
I got a report from a player about my map's replays breaking their script. When I tested it with a replay of my own, I got the following error:
--------------------------------------
/home/alzarath/Documents/StarCraft II/Accounts/#######/#-S#-#-######/Replays/Multiplayer/Impossible Cyrus (87).SC2Replay
Map: Impossible Cyrus
Date: 2025-11-22 18:28:13+00:00
Error with '/home/alzarath/Documents/StarCraft II/Accounts/#######/#-S#-#-######/Replays/Multiplayer/Impossible Cyrus (87).SC2Replay':
string index out of range
Traceback (most recent call last):
File "/home/alzarath/.local/lib/python3.14/site-packages/sc2reader/scripts/sc2printer.py", line 175, in <module>
main()
~~~~^^
File "/home/alzarath/.local/lib/python3.14/site-packages/sc2reader/scripts/sc2printer.py", line 168, in main
printReplay(filepath, arguments)
~~~~~~~~~~~^^^^^^^^^^^^^^^^^^^^^
File "/home/alzarath/.local/lib/python3.14/site-packages/sc2reader/scripts/sc2printer.py", line 23, in printReplay
lineups = [team.lineup for team in replay.teams]
^^^^^^^^^^^
File "/home/alzarath/.local/lib/python3.14/site-packages/sc2reader/objects.py", line 48, in lineup
return "".join(sorted(p.play_race[0].upper() for p in self.players))
~~~~~~^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/home/alzarath/.local/lib/python3.14/site-packages/sc2reader/objects.py", line 48, in <genexpr>
return "".join(sorted(p.play_race[0].upper() for p in self.players))
~~~~~~~~~~~^^^
IndexError: string index out of range
My CPU player, the seventh player, Player 14, is considered "Neutral" for its race (set in the Player Properties). The script appears to read this as an empty string, so there's no first letter to return.
Here's the replay in question. Impossible Cyrus (87).SC2Replay.zip
- Dominant language
- Python
- Stars
- 169
- Forks
- 152
- PR merge metrics
- No merged PRs in 30d
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
More from ggtracker/sc2reader
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 4/5 3-5 days Newbie friendliness 35/100
-
Difficulty 5/5 Over a week Newbie friendliness 20/100
-
Difficulty 4/5 3-5 days Newbie friendliness 25/100
-
Difficulty 4/5 3-5 days Newbie friendliness 32/100
All issues in ggtracker/sc2reader
Similar issues
-
documentation help wanted
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 90/100
simonw/sqlite-utils#872 ·
-
Difficulty 2/5 1-3 hours Newbie friendliness 88/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 82/100
-
Difficulty 2/5 1-3 hours Newbie friendliness 78/100