Closed kant2002 closed 6 years ago
I actually has crash on Mac also
INFO checking docker version
INFO checking docker can run
INFO checking docker has network sc_net
INFO creating docker local net sc_net
INFO downloading maps from SSCAI
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/__main__.py", line 132, in main
check_map_exists(args.map_dir + "/" + args.map)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/map.py", line 13, in check_map_exists
raise Exception(f"Map {map_file} could not be found")
Exception: Map /Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/maps/sscai/(2)Benzene.scx could not be found
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "/Library/Frameworks/Python.framework/Versions/3.6/bin/scbw", line 11, in <module>
sys.exit(main())
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/__main__.py", line 135, in main
download_sscait_maps(args.map_dir)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/map.py", line 18, in download_sscait_maps
download_extract_zip("http://sscaitournament.com/files/sscai_map_pack.zip", map_dir)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/utils.py", line 37, in download_extract_zip
download_file(url, filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/scbw/utils.py", line 49, in download_file
opener.retrieve(url, as_file)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/urllib/request.py", line 1819, in retrieve
block = fp.read(bs)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/tempfile.py", line 483, in func_wrapper
return func(*args, **kwargs)
ValueError: read of closed file
Will try to look at it later
Okay, I think there are 2 things going on here:
1) there is http redirect when you download the file, and the downloader doesn't follow that -- on my local network it works, that's why I didn't encouter it here. https://stackoverflow.com/a/11531981 -- instead of 403 there is some 30x http response code
2) Writing files can be problematic because of permissions -- maybe it would be better to use something like ~/.scbw
folder and the windows equivalent would be LOCALAPPDATA
@kant2002 Can you test PR #9 please?
Actually, never mind. The problem was in missing os.close
https://www.logilab.org/blogentry/17873
Try master?
(you should reinstall scbw package)
Thanks, I manage to run it when update scbw
from master
I run example from the README.md -
scbw --bots "krasi0" "CherryPi" --show_all
and have following outputFirst is what seems to be some race condition here, and why maps should be downloaded to scbw folder? Maybe somewhere in the LOCALAPPDATA is more sensible default on Windows ?