A python library that extracts data from various Starcraft II resources to power tools and services for the SC2 community. Who doesn't want to hack on the games they play?
Fixes toJson in sc2reader/scripts/sc2json.py to not take encoding - encoding is not a kwarg in json.dumps in python3.7 . I'm not sure how to add tests for cli/argparse code and there don't seem to be existing tests for that part, so I hope that's ok? Also not sure about the guidelines for python2/python3 support, but this was run with python3.7.8 which should be the current main stable supported version AFAIK. I tried this patch out locally and it seemed to work for me:
before:
(starcraft-toolkit) rohit@macbook-pro ➜ starcraft2toolkit git:(master) ✗ python sc2reader/sc2reader/scripts/sc2json.py my_sample_replays/sample_replay_TvP.SC2Replay
Traceback (most recent call last):
File "sc2reader/sc2reader/scripts/sc2json.py", line 45, in <module>
main()
File "sc2reader/sc2reader/scripts/sc2json.py", line 40, in main
replay_json = factory.load_replay(args.path[0])
File "/Users/rohit/.pyvenvs/starcraft-toolkit/lib/python3.7/site-packages/sc2reader-1.5.0-py3.7.egg/sc2reader/factories/sc2factory.py", line 85, in load_replay
File "/Users/rohit/.pyvenvs/starcraft-toolkit/lib/python3.7/site-packages/sc2reader-1.5.0-py3.7.egg/sc2reader/factories/sc2factory.py", line 143, in load
File "/Users/rohit/.pyvenvs/starcraft-toolkit/lib/python3.7/site-packages/sc2reader-1.5.0-py3.7.egg/sc2reader/factories/sc2factory.py", line 154, in _load
File "/Users/rohit/.pyvenvs/starcraft-toolkit/lib/python3.7/site-packages/sc2reader-1.5.0-py3.7.egg/sc2reader/factories/plugins/utils.py", line 20, in call
... 2. is still persisted
File "/Users/rohit/.pyvenvs/starcraft-toolkit/lib/python3.7/site-packages/sc2reader-1.5.0-py3.7.egg/sc2reader/factories/plugins/replay.py", line 22, in toJSON
File "/usr/local/opt/python/Frameworks/Python.framework/Versions/3.7/lib/python3.7/json/__init__.py", line 238, in dumps
**kw).encode(obj)
TypeError: __init__() got an unexpected keyword argument 'encoding'
Fixes
toJson
insc2reader/scripts/sc2json.py
to not take encoding - encoding is not a kwarg in json.dumps in python3.7 . I'm not sure how to add tests for cli/argparse code and there don't seem to be existing tests for that part, so I hope that's ok? Also not sure about the guidelines for python2/python3 support, but this was run with python3.7.8 which should be the current main stable supported version AFAIK. I tried this patch out locally and it seemed to work for me:before:
after:
Please let me know if there's a better way I should be doing this, or if there are any other issues with the PR. Thanks!