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
231 stars 40 forks source link

Downloads from SSCAIT not working on Windows #4

Closed Jabbo16 closed 6 years ago

Jabbo16 commented 6 years ago

Got it fixed on Windows 10 by adding this lines just before the the download methods at /scbw/bot_storage.py

opener = urllib.request.build_opener()
opener.addheaders=[('User-Agent','Mozilla/5.0 (Windows NT 6.1; WOW64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/36.0.1941.0 Safari/537.36')]
urllib.request.install_opener(opener)

Main problem I found and also why I didnt create a pull request for this is that after this change the following method threw an exception and I couldnt fix it.

os.remove(f'{base_dir}/AI.zip')

The exception its thrown because its trying to delete the file but is already in use by the system. Adding a sleep didnt work.

michalsustr commented 6 years ago

Updated. I think the exception was thrown because os.remove was previously done within with block, which works on Linux, but not on Windows (because of different file table handling)