pdinklag / MinecraftStats

A Minecraft player statistics browser for the web - supports 1.13 and later!
https://discord.gg/brH5PGG8By
Other
228 stars 54 forks source link

JSONDecodeError #61

Closed Trikolon closed 5 years ago

Trikolon commented 5 years ago

I get the following error when running ´python3 update.py --server /my/servers/server/ --world myworld`:

updating profile for slydoesminecraft ...
Traceback (most recent call last):
  File "update.py", line 141, in <module>
    profile = mojang.get_player_profile(uuid)
  File "/xxxx/html/mojang.py", line 13, in get_player_profile
    profile = json.loads(response.read().decode())
  File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
    obj, end = self.raw_decode(s, idx=_w(s, 0).end())
  File "/usr/lib/python3.6/json/decoder.py", line 357, in raw_decode
    raise JSONDecodeError("Expecting value", s, err.value) from None
json.decoder.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

This error stops the update process.

Player data for my server has been converted to 1.13, but dates all the way back to 2012 so I suspect there is some invalid files in there. Looks like the application fails to parse a file? Could you just skip files that fail to parse?

Paper server on Minecraft 1.13.2

Please let me know if you need more information. I couldn't find the file which causes the error yet.

pdinklag commented 5 years ago

To find the file that causes the issue, try to find the UUID of player slydoesminecraft maybe? It appears to happen for him.

Hard to tell what's causing this, because the JSON standard doesn't change. The file must be corrupted somehow, another guess is that maybe it is empty? Hard to tell.

But yes, it should definitely continue processing if this fails.

pdinklag commented 5 years ago

Could you please try it with the commit I just made?

Trikolon commented 5 years ago

I've just ran it again. It fails on a different file now:

unsupported data version 0 for MrEpicman1111 (09f86fa8-b595-4cef-b775-33422c9044f2)                                                          │
Traceback (most recent call last):                                                                                                           │
  File "update.py", line 285, in <module>                                                                                                    │
    'name':         player['name'],                                                                                                          │
KeyError: 'name'  

Stat file: https://gist.github.com/Trikolon/dc7d41ed3b5c9601d5f8ec8f0ce2af61 I'm not 100% sure if that's the file causing the failure though.

pdinklag commented 5 years ago

"Unsupported data version" just means that the file hasn't been updated for 1.13, i.e., that player has never logged in since your switch to 1.13. So the first line is not concerning.

The traceback issue is a different thing now, but I know what it is. Will fix it quickly!

pdinklag commented 5 years ago

Please try again. 😄

Trikolon commented 5 years ago

Great, it works now. Thanks for your quick fix!