python-sc2 icon indicating copy to clipboard operation
python-sc2 copied to clipboard

exception thrown when get_next_expansion returns a null

Open ericbroda opened this issue 7 years ago • 2 comments

When trying to expand, the function bot_ai.expand_now calls get_next_expansion which can return a null (will happen late in the game when no expansions are available), however, bot_ai.expand_now does not handle the null returned value.

There should be a check to see if there are any available expansion sites, and if there are not any available, then the null returned value (from get_next_expansion) should have handled without throwing an unexpected exception

ericbroda avatar Nov 17 '18 17:11 ericbroda

Similar thing happened to me. File "C:\Users\s\sc2\bot_ai.py", line 139, in expand_now await self.build(building, near=location, max_distance=max_distance, random_alternative=False, placement_step=1) File "C:\Users\s\sc2\bot_ai.py", line 408, in build p = await self.find_placement(building, near.rounded, max_distance, random_alternative, placement_step) AttributeError: 'NoneType' object has no attribute 'rounded'

savelas avatar Dec 12 '18 15:12 savelas

I have also picked up an issue that might be related. On King's Cove LE, the "possible_points" generator in the BotAI.expansion_locations function is empty on one of the resources in resource_groups and the min function fails with "ValueError: min() arg is an empty sequence".

danielvschoor avatar May 03 '19 19:05 danielvschoor