Closed Anthomedal closed 6 years ago
My best guess is that is has something to do with your game and python installations being in different drives. I couldn't tell you what is wrong because I can't duplicate the error. On the bright side... your code works
Thank you for your answer, I installed Python in same disk as Starcraft II and the error changed :
=== ERROR ===
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
Traceback (most recent call last):
File "E:\Documents\Programmes\Windows\Programmes_Python\IA_Sc2\hataoylachance.
py", line 33, in <module>
], realtime=True)
File "E:\Programme\Python\lib\site-packages\sc2\main.py", line 187, in run_gam
e
_host_game(map_settings, players, **kwargs)
File "E:\Programme\Python\lib\asyncio\base_events.py", line 568, in run_until_
complete
return future.result()
File "E:\Programme\Python\lib\site-packages\sc2\main.py", line 109, in _host_g
ame
async with SC2Process() as server:
File "E:\Programme\Python\lib\site-packages\sc2\sc2process.py", line 57, in __
aenter__
self._ws = await self._connect()
File "E:\Programme\Python\lib\site-packages\sc2\sc2process.py", line 99, in _c
onnect
ws = await websockets.connect(self.ws_url, timeout=120)
File "E:\Programme\Python\lib\site-packages\websockets\client.py", line 397, i
n __await__
transport, protocol = yield from self._creating_connection
TypeError: cannot 'yield from' a coroutine object in a non-coroutine generator
sys:1: RuntimeWarning: coroutine 'BaseEventLoop.create_connection' was never awa
ited
No windows open in this case...
Have you an idea now ?
Thank you
I can't come up with anything to help. All I know is that the code should be right, so it's something to do with your set up. I just can't duplicate the error on my end.
So I can't do anything ?
In https://docs.python.org/3/reference/expressions.html?highlight=subscript I can read :
"To ensure the comprehension always results in a container of the appropriate type, yield and yield from expressions are prohibited in the implicitly nested scope (in Python 3.7, such expressions emit DeprecationWarning when compiled, in Python 3.8+ they will emit SyntaxError)."
And you can see an error linked to "yeld from" in my shell, I will use another python version maybe ?
When I try to run SC2_x64.exe I have an error : missing icuin52.dll.
I installed dll an know I have just an application error : can't begin correctly...
My code don't works already...
I had this error too. I was using Python 3.7.
I've now downgraded to 3.6 and it seems to launch SC2 now.
I tried with Python 3.6.0, 3.6.1, 3.6.2, ..., 3.6.6 and I have same error each time : the same as begining. However in this cases a window open before crash.
indusninja, have you the same error ?
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.Protoss, <__main__.SentdeBot object at 0x0
000000004393978>), Computer(Race.Terran, Difficulty.Easy)
INFO:sc2.protocol:Client status changed to Status.init_game (was Status.launched
)
INFO:sc2.protocol:Client status changed to Status.launched (was None)
INFO:root:Player id: 0
INFO:sc2.sc2process:kill_switch: Process cleanup
INFO:sc2.sc2process:Cleaning up...
INFO:sc2.sc2process:Cleanup complete
Traceback (most recent call last):
File "E:\Documents\Programmes\Windows\Programmes_Python\IA_Sc2\hataoylachance.
py", line 33, in <module>
], realtime=True)
File "E:\Programme\Python\Python3.6.6\lib\site-packages\sc2\main.py", line 187
, in run_game
_host_game(map_settings, players, **kwargs)
File "E:\Programme\Python\Python3.6.6\lib\asyncio\base_events.py", line 468, i
n run_until_complete
return future.result()
File "E:\Programme\Python\Python3.6.6\lib\site-packages\sc2\main.py", line 115
, in _host_game
result = await _play_game(players[0], client, realtime, portconfig, step_tim
e_limit, game_time_limit)
File "E:\Programme\Python\Python3.6.6\lib\site-packages\sc2\main.py", line 87,
in _play_game
result = await _play_game_ai(client, player_id, player.ai, realtime, step_ti
me_limit, game_time_limit)
File "E:\Programme\Python\Python3.6.6\lib\site-packages\sc2\main.py", line 29,
in _play_game_ai
game_data = await client.get_game_data()
File "E:\Programme\Python\Python3.6.6\lib\site-packages\sc2\client.py", line 1
10, in get_game_data
upgrade_id=True
File "E:\Programme\Python\Python3.6.6\lib\site-packages\sc2\protocol.py", line
56, in _execute
raise ProtocolError(f"{response.error}")
sc2.protocol.ProtocolError: ['A game has not been started yet']
For people who it works : have you an error when you try to run SC2_x64.exe ? (manually)
Can you add your path.py code from the sc2 package. Maybe your BINPATH is wrong.
My paths.py file :
import os
from pathlib import Path
import platform
import logging
logger = logging.getLogger(__name__)
BASEDIR = {
"Windows": "E:\Programme\StarCraft II",
"Darwin": "/Applications/StarCraft II",
"Linux": "~/StarCraftII"
}
BINPATH = {
"Windows": "SC2_x64.exe",
"Darwin": "SC2.app/Contents/MacOS/SC2",
"Linux": "SC2_x64"
}
CWD = {
"Windows": "Support64",
"Darwin": None,
"Linux": None
}
PF = platform.system()
def get_env():
# TODO: Linux env conf from: https://github.com/deepmind/pysc2/blob/master/pysc2/run_configs/platforms.py
return None
def latest_executeble(versions_dir):
latest = max((int(p.name[4:]), p) for p in versions_dir.iterdir() if p.is_dir() and p.name.startswith("Base"))
version, path = latest
if version < 55958:
logger.critical(f"Your SC2 binary is too old. Upgrade to 3.16.1 or newer.")
exit(1)
return path / BINPATH[PF]
class _MetaPaths(type):
""""Lazily loads paths to allow importing the library even if SC2 isn't installed."""
def __setup(self):
if PF not in BASEDIR:
logger.critical(f"Unsupported platform '{PF}'")
exit(1)
try:
self.BASE = Path(os.environ.get("SC2PATH", BASEDIR[PF])).expanduser()
self.EXECUTABLE = latest_executeble(self.BASE / "Versions")
self.CWD = self.BASE / CWD[PF] if CWD[PF] else None
self.REPLAYS = self.BASE / "Replays"
if (self.BASE / "maps").exists():
self.MAPS = self.BASE / "maps"
else:
self.MAPS = self.BASE / "Maps"
except FileNotFoundError as e:
logger.critical(f"SC2 installation not found: File '{e.filename}' does not exist.")
exit(1)
def __getattr__(self, attr):
self.__setup()
return getattr(self, attr)
class Paths(metaclass=_MetaPaths):
"""Paths for SC2 folders, lazily loaded using the above metaclass."""
I don't think it's the paths file. If it was wrong, you wouldn't be able to run anything. It would just spit out that it couldn't find the SC executable. What confuses me is the line INFO:root:Player id: 0
. I was trying to debug how this could happen and I couldn't figure it out since it was registering that there were 2 players in the game. Maybe someone will find luck with that
Maybe try #52. Redownload the maps and extract them again
THAT'S WORKS !! When I installed maps I entered no password, I just clicking on "OK", but after extract maps with the password the game run !
Thank you very very much ! Good bye ! :D
Closing as fixed. Please comment here if there are any further issues with this. Or just open a new issue if you are not sure if they are related.
Hello,
I tried this tutorial : https://www.youtube.com/watch?v=v3LJ6VvpfgI&lc=z23dvvr5jvbiyzvtoacdp43boy35vhpmr4lyn3lug2lw03c010c.1530380446748170
The code :
However, when I run the code, i have this message in shell :
=== ERROR MESSAGE ===
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.Protoss, <__main__.SentdeBot object at 0x0 3919070>), Computer(Race.Terran, Difficulty.Easy) INFO:sc2.protocol:Client status changed to Status.init_game (was Status.launched ) INFO:sc2.protocol:Client status changed to Status.launched (was None) INFO:root:Player id: 0 INFO:sc2.sc2process:kill_switch: Process cleanup INFO:sc2.sc2process:Cleaning up... INFO:sc2.sc2process:Cleanup complete Traceback (most recent call last): File "E:\Documents\Programmes\Windows\Programmes_Python\IA_Sc2\hataoylachance. py", line 33, in <module> ], realtime=False) File "C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\lib\site-pack ages\sc2\main.py", line 187, in run_game _host_game(map_settings, players, **kwargs) File "C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\lib\asyncio\b ase_events.py", line 468, in run_until_complete return future.result() File "C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\lib\site-pack ages\sc2\main.py", line 115, in _host_game result = await _play_game(players[0], client, realtime, portconfig, step_tim e_limit, game_time_limit) File "C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\lib\site-pack ages\sc2\main.py", line 87, in _play_game result = await _play_game_ai(client, player_id, player.ai, realtime, step_ti me_limit, game_time_limit) File "C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\lib\site-pack ages\sc2\main.py", line 29, in _play_game_ai game_data = await client.get_game_data() File "C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\lib\site-pack ages\sc2\client.py", line 110, in get_game_data upgrade_id=True File "C:\Users\Anthony\AppData\Local\Programs\Python\Python36-32\lib\site-pack ages\sc2\protocol.py", line 56, in _execute raise ProtocolError(f"{response.error}") sc2.protocol.ProtocolError: ['A game has not been started yet']
=== SYSTEM === Windows 7 64 bits Python 3.6.5 python-sc2 installed with pip Version of python-sc2 : 0.8.4 (I think, I have the file sc2-0.8.4.dist-info in site-packages on python)
Have you an idea ?
Thank you !