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

RuntimeError: map_path file doesn't exist

Open LecJackS opened this issue 7 years ago • 5 comments
trafficstars

Trying to run the simplest bot for testing after installation, results in this:

import sc2
from sc2 import run_game, maps, Race, Difficulty
from sc2.player import Bot, Computer

class WorkerRushBot(sc2.BotAI):
    async def on_step(self, iteration):
        if iteration == 0:
            for worker in self.workers:
                await self.do(worker.attack(self.enemy_start_locations[0]))

run_game(maps.get("Abyssal Reef LE"), [
    Bot(Race.Zerg, WorkerRushBot()),
    Computer(Race.Protoss, Difficulty.Medium)
], realtime=True)

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.Zerg, <main.WorkerRushBot object at 0x7f92164b7208>), Computer(Race.Protoss, Difficulty.Medium) CRITICAL:sc2.main:Could not create game: CreateGameError.InvalidMapPath: map_path file doesn't exist. INFO:sc2.sc2process:kill_switch: Process cleanup INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete


RuntimeError Traceback (most recent call last) in () 12 Bot(Race.Zerg, WorkerRushBot()), 13 Computer(Race.Protoss, Difficulty.Medium) ---> 14 ], realtime=True)

~/.local/lib/python3.6/site-packages/sc2/main.py in run_game(map_settings, players, **kwargs) 185 result = asyncio.get_event_loop().run_until_complete( 186 _host_game(map_settings, players, **kwargs) --> 187 ) 188 return result

~/anaconda3/lib/python3.6/asyncio/base_events.py in run_until_complete(self, future) 465 raise RuntimeError('Event loop stopped before Future completed.') 466 --> 467 return future.result() 468 469 def stop(self):

~/.local/lib/python3.6/site-packages/sc2/main.py in _host_game(map_settings, players, realtime, portconfig, save_replay_as, step_time_limit, game_time_limit) 110 await server.ping() 111 client = await _setup_host_game(server, map_settings, players, realtime) --> 112 113 try: 114 result = await _play_game(players[0], client, realtime, portconfig, step_time_limit, game_time_limit)

~/.local/lib/python3.6/site-packages/sc2/main.py in _setup_host_game(server, map_settings, players, realtime) 97 err += f": {r.create_game.error_details}" 98 logger.critical(err) ---> 99 raise RuntimeError(err) 100 101 return Client(server._ws)

RuntimeError: Could not create game: CreateGameError.InvalidMapPath: map_path file doesn't exist.

System: Ubuntu 18.04

Downloaded SC2 3.17 linux package from its source: https://github.com/Blizzard/s2client-proto#downloads

Extracted it into /home as is suggested.

Downloaded all 2017-2018 Map Packs and extracted them in Maps inside StarCraft2 folder, in each respective folder.

Any idea whats the issue?

LecJackS avatar Aug 04 '18 00:08 LecJackS

Check if the map name is really Abyssal Reef LE, mine isAbyssalReefLE. The folder must be Maps in the StarCraft folder. The complete path to the map should be C:\Program Files (x86)\StarCraft II\Maps\AbyssalReefLE.SC2Map

tweakimp avatar Aug 06 '18 20:08 tweakimp

@tweakimp Both ways of calling the map, with and without spaces, are valid.

AbyssalReefLE produces the same result. Any other name in the Maps folder, too.

An invalid name returns another kind of error:

---------------------------------------------------------------------------
KeyError                                  Traceback (most recent call last)
<ipython-input-6-821ae0ae14a5> in <module>()
      9                 await self.do(worker.attack(self.enemy_start_locations[0]))
     10
---> 11 run_game(maps.get("AbyssalReefLX"), [
     12     Bot(Race.Zerg, WorkerRushBot()),
     13     Computer(Race.Protoss, Difficulty.Medium)

~/.local/lib/python3.6/site-packages/sc2/maps.py in get(name)
     22             return m
     23
---> 24     raise KeyError(f"Map '{name}' was not found. Please put the map file in \"/StarCraft II/Maps/\".")
     25
     26 class Map(object):

KeyError: 'Map \'AbyssalReefLX\' was not found. Please put the map file in "/StarCraft II/Maps/".'

LecJackS avatar Aug 06 '18 22:08 LecJackS

I'm running into this issue too on Ubuntu 16.04. I wonder if anyone has actually succesfully been able to run this on linux?

varunbalupuri avatar Aug 07 '18 13:08 varunbalupuri

I realized that I downloaded the linux package version 3.17, while there is a 4.1.2 version.

https://github.com/Blizzard/s2client-proto#downloads

I downloaded that, copied the maps inside Maps, and a new similar exception was raised, but now with a new detail:

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.Zerg, <__main__.WorkerRushBot object at 0x7fb11f6ea518>), Computer(Race.Protoss, Difficulty.Medium)
CRITICAL:sc2.main:Could not create game: CreateGameError.InvalidMapPath: map_path '/home/jack/StarCraftII/maps/Ladder2017Season1/AbyssalReefLE.SC2Map' file doesn't exist.
INFO:sc2.sc2process:kill_switch: Process cleanup
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete

---------------------------------------------------------------------------
RuntimeError                              Traceback (most recent call last)
<ipython-input-7-1e52d3a263e6> in <module>()
     12     Bot(Race.Zerg, WorkerRushBot()),
     13     Computer(Race.Protoss, Difficulty.Medium)
---> 14 ], realtime=True)

~/.local/lib/python3.6/site-packages/sc2/main.py in run_game(map_settings, players, **kwargs)
    184     else:
    185         result = asyncio.get_event_loop().run_until_complete(
--> 186             _host_game(map_settings, players, **kwargs)
    187         )
    188     return result

~/anaconda3/lib/python3.6/asyncio/base_events.py in run_until_complete(self, future)
    465             raise RuntimeError('Event loop stopped before Future completed.')
    466 
--> 467         return future.result()
    468 
    469     def stop(self):

~/.local/lib/python3.6/site-packages/sc2/main.py in _host_game(map_settings, players, realtime, portconfig, save_replay_as, step_time_limit, game_time_limit)
    109     async with SC2Process() as server:
    110         await server.ping()
--> 111         client = await _setup_host_game(server, map_settings, players, realtime)
    112 
    113         try:

~/.local/lib/python3.6/site-packages/sc2/main.py in _setup_host_game(server, map_settings, players, realtime)
     97             err += f": {r.create_game.error_details}"
     98         logger.critical(err)
---> 99         raise RuntimeError(err)
    100 
    101     return Client(server._ws)

RuntimeError: Could not create game: CreateGameError.InvalidMapPath: map_path '/home/jack/StarCraftII/maps/Ladder2017Season1/AbyssalReefLE.SC2Map' file doesn't exist.

'/home/jack/StarCraftII/maps/Ladder2017Season1/AbyssalReefLE.SC2Map' file doesn't exist., where maps folder is with lowercase M.

So I duplicate the Maps folder to a new maps folder in the same directory, and the bot started to work :)

Final directory structure

me:~/StarCraftII$ ls
AppData  Battle.net  Interfaces  Libs  Maps  maps  Replays  SC2Data  Versions
me:~/StarCraftII$ ls Maps/
Ladder2017Season1  Ladder2017Season3  Ladder2018Season1
Ladder2017Season2  Ladder2017Season4  Ladder2018Season2
me:~/StarCraftII$ ls maps/
Ladder2017Season1  Ladder2017Season3  Ladder2018Season1
Ladder2017Season2  Ladder2017Season4  Ladder2018Season2
me:~/StarCraftII$ ls Maps/Ladder2017Season1/
AbyssalReefLE.SC2Map     CactusValleyLE.SC2Map  NewkirkPrecinctTE.SC2Map   ProximaStationLE.SC2Map
BelShirVestigeLE.SC2Map  HonorgroundsLE.SC2Map  PaladinoTerminalLE.SC2Map

@varunbalupuri check if that works for you.

LecJackS avatar Aug 07 '18 14:08 LecJackS

I had the same issue with my docker image. I had to use lower case maps for some reason to fix my problem. https://hub.docker.com/r/burnysc2/python-sc2-docker/~/dockerfile/

BurnySc2 avatar Aug 08 '18 15:08 BurnySc2