skybaks / pyplanet-cup_manager

Competition Management Plugin for Trackmania Pyplanet
GNU General Public License v3.0
7 stars 2 forks source link

Decode downloaded json response as string #74

Closed The-Jonsey closed 3 months ago

The-Jonsey commented 3 months ago

In the current version when you do //cup config download it errors out due to the f.write of the config expecting a string, but the download_file passes it a bytea, as can be seen here:

Aug 08 19:19:21 ip-172-31-13-195 python[29052]: ERROR    [default][skybaks.cup_manager.config] write() argument must be str, not bytes
Aug 08 19:19:21 ip-172-31-13-195 python[29052]: Traceback (most recent call last):
Aug 08 19:19:21 ip-172-31-13-195 python[29052]:   File "/home/ubuntu/.pyenv/versions/trackmania/lib/python3.7/site-packages/skybaks/cup_manager/config.py", line 221, in write_file_from_config_dir

Decoding the bytea to a string before it passes it to the write file method allows the download function to work

skybaks commented 3 months ago

I guess I only ever tested on windows. I wonder if this just behaves differently on linux? In any case it looks like this works for my testing so I'm happy to merge it in. Thanks for the pull request