Error in Python 3 Mac OS API


#1

I am just spinning up on using the Halite API in Python 3 and I ran the ./run_game.sh and I am getting an error with the WIDTH variable, would anyone know what the issue is here?

[info] Map seed is 1544497346
[info] [P0] Launching with command python3 MyBot.py
[info] [P1] Launching with command python3 MyBot.py
[info] [P0] Initializing player
[info] [P1] Initializing player
[error] [P1] Failed to initialize
[error] [P1] Player’s error output was:
[error] [P1] Traceback (most recent call last):
[error] [P1] File “MyBot.py”, line 23, in
[error] [P1] game = hlt.Game()
[error] [P1] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/networking.py”, line 35, in init
[error] [P1] self.players[player] = Player._generate()
[error] [P1] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/player.py”, line 64, in _generate
[error] [P1] return Player(player, Shipyard(player, -1, Position(shipyard_x, shipyard_y)))
[error] [P1] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/positionals.py”, line 70, in init
[error] [P1] self.normalize()
[error] [P1] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/positionals.py”, line 73, in normalize
[error] [P1] self.x = self.x % constants.WIDTH
[error] [P1] AttributeError: module ‘hlt.constants’ has no attribute ‘WIDTH’
[error] [P0] Failed to initialize
[error] [P0] Player’s error output was:
[error] [P0] Traceback (most recent call last):
[error] [P0] File “MyBot.py”, line 23, in
[error] [P0] game = hlt.Game()
[error] [P0] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/networking.py”, line 35, in init
[error] [P0] self.players[player] = Player._generate()
[error] [P0] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/player.py”, line 64, in _generate
[error] [P0] return Player(player, Shipyard(player, -1, Position(shipyard_x, shipyard_y)))
[error] [P0] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/positionals.py”, line 70, in init
[error] [P0] self.normalize()
[error] [P0] File “/Users/anthonybisulco/Documents/Projects/Github/Halite/Halite3_Python3_MacOS/hlt/positionals.py”, line 73, in normalize
[error] [P0] self.x = self.x % constants.WIDTH
[error] [P0] AttributeError: module ‘hlt.constants’ has no attribute ‘WIDTH’
[warn] [P0] Killing player
[warn] [P1] Killing player
[info] Player initialization complete
[info] [1] [P0] player has insufficient resources to continue
[info] [1] [P1] player has insufficient resources to continue
[info] [1] Game has ended
[info] Opening a file at replays/replay-20181210-220226-0500-1544497346-32-32.hlt
[info] Player 0, ‘(failed to initialize)’, was rank 1 with 0 halite
[info] Player 1, ‘(failed to initialize)’, was rank 2 with 0 halite
[info] [P0] Player has log output. Writing a log at replays/errorlog-20181210-220226-0500-1544497346-32-32-0.log
[info] [P1] Player has log output. Writing a log at replays/errorlog-20181210-220226-0500-1544497346-32-32-1.log


#2

There was a change 4 days ago that fixed this - https://github.com/HaliteChallenge/Halite-III/commit/7412d36489102ce67c46f2ff55bc2779eaf7c878
Make sure you have checked out the most recent version.


#3

Hi @abisulco, there’s a bug in the current kit. A fix is coming in https://github.com/HaliteChallenge/Halite-III/pull/181.


#4

Fix now out, please see [PSA] Re-download Python starter kit if you started between 12/10 and 12/11.