diff --git a/examples/competitive/__init__.py b/examples/competitive/__init__.py index 992b1d10..b28e6f8c 100644 --- a/examples/competitive/__init__.py +++ b/examples/competitive/__init__.py @@ -7,6 +7,7 @@ import sc2 from sc2 import Race, Difficulty from sc2.player import Bot, Computer +from sc2.protocol import ConnectionAlreadyClosed from sc2.sc2process import SC2Process from sc2.client import Client diff --git a/sc2/paths.py b/sc2/paths.py index 98d45a4c..33e7b9c8 100644 --- a/sc2/paths.py +++ b/sc2/paths.py @@ -39,13 +39,16 @@ def get_env(): def get_runner_args(cwd): if "WINE" in os.environ: - runner_dir = os.path.dirname(os.environ.get("WINE")) - # translate cwd from Unix to Windows path - win_cwd = subprocess.run( - [os.path.join(runner_dir, "winepath"), "-w", cwd], capture_output=True, text=True - ).stdout.rstrip() - return [os.environ.get("WINE"), "start", "/d", win_cwd, "/unix"] - + runner_file = Path(os.environ.get("WINE")) + runner_file = runner_file if runner_file.is_file() else runner_file / "wine" + """ + TODO Is converting linux path really necessary? + That would convert + '/home/burny/Games/battlenet/drive_c/Program Files (x86)/StarCraft II/Support64' + to + 'Z:\\home\\burny\\Games\\battlenet\\drive_c\\Program Files (x86)\\StarCraft II\\Support64' + """ + return [runner_file, "start", "/d", cwd, "/unix"] return [] diff --git a/sc2/proxy.py b/sc2/proxy.py index 0c3e8be3..9f6f089b 100644 --- a/sc2/proxy.py +++ b/sc2/proxy.py @@ -152,7 +152,7 @@ async def proxy_handler(self, request): return bot_ws async def play_with_proxy(self, startport): - logger.info(f"Proxy({self.port}): starting app") + logger.info(f"Proxy({self.port}): Starting app") app = web.Application() app.router.add_route("GET", "/sc2api", self.proxy_handler) apprunner = web.AppRunner(app, access_log=None) @@ -167,6 +167,7 @@ async def play_with_proxy(self, startport): subproc_args["creationflags"] = subprocess.CREATE_NEW_PROCESS_GROUP player_command_line = self.player.cmd_line(self.port, startport, self.controller._process._host) + logger.info(f"Starting bot with command: {' '.join(player_command_line)}") if self.player.stdout is None: bot_process = subprocess.Popen(player_command_line, stdout=subprocess.DEVNULL, **subproc_args) else: