Games-and-Simulations / sc-docker

Multi-platform Version of StarCraft: Brood War in a Docker Container, ready to use for bot play simulations.
MIT License
230 stars 41 forks source link

Error writing scores.json on Windows 10 #70

Closed MicroDK closed 6 years ago

MicroDK commented 6 years ago

expected behaviour

After a games ends it should write the result to terminal window.

actual behaviour

After a games ends, an error occurs when writing the scores.json file.

steps to reproduce

C:\Users\micky>scbw.play --bots "Microwave" "Locutus" --headless --read_overwrite --game_speed 0 --map "sscai/(4)Empire of the Sun.scm" --log_level=DEBUG --log_verbose 2018-05-05 10:42:39 DEBUG docker.utils.config[13240] Trying paths: ['C:\Users\micky\.docker\config.json', 'C:\Users\micky\.dockercfg'] 2018-05-05 10:42:39 DEBUG docker.utils.config[13240] No config file found 2018-05-05 10:42:39 DEBUG docker.utils.config[13240] Trying paths: ['C:\Users\micky\.docker\config.json', 'C:\Users\micky\.dockercfg'] 2018-05-05 10:42:39 DEBUG docker.utils.config[13240] No config file found 2018-05-05 10:42:39 DEBUG scbw.bot_storage[13240] checking bot in C:\Users\micky\AppData\Roaming/scbw/bots/Microwave 2018-05-05 10:42:39 DEBUG scbw.bot_storage[13240] found bot in C:\Users\micky\AppData\Roaming/scbw/bots/Microwave 2018-05-05 10:42:39 DEBUG scbw.bot_storage[13240] checking bot in C:\Users\micky\AppData\Roaming/scbw/bots/Locutus 2018-05-05 10:42:39 DEBUG scbw.bot_storage[13240] found bot in C:\Users\micky\AppData\Roaming/scbw/bots/Locutus 2018-05-05 10:42:39 DEBUG scbw.docker_utils[13240] checking docker-machine presence 2018-05-05 10:42:39 DEBUG scbw.docker_utils[13240] using docker machine version version 0.13.0, build 9ba6da9 Error: No machine name(s) specified and no "default" machine exists 2018-05-05 10:42:39 DEBUG scbw.docker_utils[13240] docker machine not present 2018-05-05 10:42:39 DEBUG scbw.game[13240] Using vnc host 'localhost' 2018-05-05 10:42:39 DEBUG scbw.docker_utils[13240] docker_image=starcraft:game-1.0.1 command=[ '/app/play_bot.sh', '--game', 'GAME_960120B2', '--name', 'Microwave', '--race', 'Z', '--lan', '--host', '--map', '/app/sc/maps/sscai/(4)Empire of the Sun.scm'] name=GAME_960120B2_0_Microwave detach=True environment={ 'BOT_BWAPI': '4.1.2', 'BOT_FILE': 'Microwave.dll', 'CAPTURE_MOUSE_MOVEMENT': '0', 'DROP_PLAYERS': '0', 'EXIT_CODE_REALTIME_OUTED': 2, 'GAME_NAME': 'GAME_960120B2', 'GAME_TYPE': 'FREE_FOR_ALL', 'HEADFUL_AUTO_LAUNCH': '0', 'HIDE_NAMES': '0', 'JAVA_DEBUG': '0', 'MAP_NAME': '/app/sc/maps/sscai/(4)Empire of the Sun.scm', 'NTH_PLAYER': 0, 'NUM_PLAYERS': 2, 'PLAYER_NAME': 'Microwave', 'PLAYER_RACE': 'Z', 'SPEED_OVERRIDE': 0, 'TM_ALLOW_USER_INPUT': '0', 'TM_LOG_FRAMETIMES': '../logs/frames.csv', 'TM_LOG_RESULTS': '../logs/scores.json', 'TM_SPEED_OVERRIDE': 0} privileged=True volumes={ '//c/Users/micky/AppData/Roaming/scbw/bots/Microwave': { 'bind': '/app/bot', 'mode': 'ro'}, '//c/Users/micky/AppData/Roaming/scbw/bwapi-data/BWTA': { 'bind': '/app/sc/bwapi-data/BWTA', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/bwapi-data/BWTA2': { 'bind': '/app/sc/bwapi-data/BWTA2', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/games/GAME_960120B2/logs_0': { 'bind': '/app/logs', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/games/GAME_960120B2/write_0/': { 'bind': '/app/sc/bwapi-data/write', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/maps': { 'bind': '/app/sc/maps', 'mode': 'rw'}} network=sc_net ports={}

2018-05-05 10:42:40 INFO scbw.docker_utils[13240] launched BotPlayer:Microwave:Z 2018-05-05 10:42:40 DEBUG scbw.docker_utils[13240] container name = 'GAME_960120B2_0_Microwave', container id = '['223a4ecb69']' 2018-05-05 10:42:40 DEBUG scbw.docker_utils[13240] docker_image=starcraft:game-1.0.1 command=[ '/app/play_bot.sh', '--game', 'GAME_960120B2', '--name', 'Locutus', '--race', 'P', '--lan', '--join'] name=GAME_960120B2_1_Locutus detach=True environment={ 'BOT_BWAPI': '4.1.2', 'BOT_FILE': 'Locutus.dll', 'CAPTURE_MOUSE_MOVEMENT': '0', 'DROP_PLAYERS': '0', 'EXIT_CODE_REALTIME_OUTED': 2, 'GAME_NAME': 'GAME_960120B2', 'GAME_TYPE': 'FREE_FOR_ALL', 'HEADFUL_AUTO_LAUNCH': '0', 'HIDE_NAMES': '0', 'JAVA_DEBUG': '0', 'MAP_NAME': '/app/sc/maps/sscai/(4)Empire of the Sun.scm', 'NTH_PLAYER': 1, 'NUM_PLAYERS': 2, 'PLAYER_NAME': 'Locutus', 'PLAYER_RACE': 'P', 'SPEED_OVERRIDE': 0, 'TM_ALLOW_USER_INPUT': '0', 'TM_LOG_FRAMETIMES': '../logs/frames.csv', 'TM_LOG_RESULTS': '../logs/scores.json', 'TM_SPEED_OVERRIDE': 0} privileged=True volumes={ '//c/Users/micky/AppData/Roaming/scbw/bots/Locutus': { 'bind': '/app/bot', 'mode': 'ro'}, '//c/Users/micky/AppData/Roaming/scbw/bwapi-data/BWTA': { 'bind': '/app/sc/bwapi-data/BWTA', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/bwapi-data/BWTA2': { 'bind': '/app/sc/bwapi-data/BWTA2', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/games/GAME_960120B2/logs_1': { 'bind': '/app/logs', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/games/GAME_960120B2/write_1/': { 'bind': '/app/sc/bwapi-data/write', 'mode': 'rw'}, '//c/Users/micky/AppData/Roaming/scbw/maps': { 'bind': '/app/sc/maps', 'mode': 'rw'}} network=sc_net ports={}

2018-05-05 10:42:41 INFO scbw.docker_utils[13240] launched BotPlayer:Locutus:P 2018-05-05 10:42:41 DEBUG scbw.docker_utils[13240] container name = 'GAME_960120B2_1_Locutus', container id = '['e4fc4aeef9']' 2018-05-05 10:42:41 DEBUG scbw.docker_utils[13240] checking if game has launched properly... 2018-05-05 10:42:42 INFO scbw.docker_utils[13240] waiting until game GAME_960120B2 is finished... 2018-05-05 10:42:42 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:42:45 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:42:48 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:42:51 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:42:54 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:42:57 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:00 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:03 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:06 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:09 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:13 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:16 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:19 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:22 DEBUG scbw.docker_utils[13240] waiting. ['e4fc4aeef9', '223a4ecb69'] 2018-05-05 10:43:25 DEBUG scbw.docker_utils[13240] removing game containers 2018-05-05 10:43:25 INFO scbw.docker_utils[13240] overwriting bot files 2018-05-05 10:43:25 DEBUG scbw.docker_utils[13240] overwriting files for BotPlayer:Microwave:Z 2018-05-05 10:43:25 DEBUG scbw.docker_utils[13240] overwriting files for BotPlayer:Locutus:P Traceback (most recent call last): File "c:\users\micky\appdata\local\programs\python\python36\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "c:\users\micky\appdata\local\programs\python\python36\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\micky\AppData\Local\Programs\Python\Python36\Scripts\scbw.play.exe__main__.py", line 9, in File "c:\users\micky\appdata\local\programs\python\python36\lib\site-packages\scbw\cli.py", line 224, in main game_result = run_game(args) File "c:\users\micky\appdata\local\programs\python\python36\lib\site-packages\scbw\game.py", line 138, in run_game is_crashed=game_result.is_crashed, File "c:\users\micky\appdata\local\programs\python\python36\lib\site-packages\scbw\result.py", line 133, in is_crashed self._process_files() File "c:\users\micky\appdata\local\programs\python\python36\lib\site-packages\scbw\result.py", line 92, in _process_files winner_scorefile.replace('/scores.json', '').split('')[(-1)]) ValueError: invalid literal for int() with base 10: '1\scores.json'

operating system

Windows 10 Pro

docker version

output of command docker version:

Client: Version: 17.12.0-ce API version: 1.35 Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:05:22 2017 OS/Arch: windows/amd64

Server: Engine: Version: 17.12.0-ce API version: 1.35 (minimum version 1.12) Go version: go1.9.2 Git commit: c97c6d6 Built: Wed Dec 27 20:12:29 2017 OS/Arch: linux/amd64 Experimental: true

scbw version

output of command scbw.play -v

1.0.1
kant2002 commented 6 years ago

@MicroDK Fixed in the #68 , have #69 to have more robust implementation. This should be out in the 1.0.2 or when @michalsustr decide to do release

MicroDK commented 6 years ago

Sorry, I was not aware of that. ;)

kant2002 commented 6 years ago

With small community what we have it is better over report, then under report issues 😄

RothNath commented 6 years ago

I've got the same error noted above. ie. ValueError: invalid literal for int() with base 10: '1\scores.json'

When it occurs it also seems to stop replays from being created. In both headless mode and not. Edit: NVM replays just moved folders from scbw/maps/replays to scbw/games after an update.