This script transfers character between worlds in Palworld, which allows friends to transfer their characters to each other's server without losing one's progress.
93
stars
5
forks
source link
Bug: Save output of SaveConverter to JSON throws UUID error #11
Converting C:\(...)\Level.sav to JSON, saving to output.json
Decompressing sav file
Loading GVAS file
Writing JSON to output.json
[TRACEBACK INFO ...]
File "C:\(...)\PalworldCharacterTransfer\lib\noindent.py", line 36, in default
return super(CustomEncoder, self).default(obj)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\(...)\Lib\json\encoder.py", line 180, in default
raise TypeError(f'Object of type {o.__class__.__name__} '
TypeError: Object of type UUID is not JSON serializable
Cause
Error is thrown because CustomEncoder.default expects to recieve uuid.UUID but instead recieves custom UUID wrapper lib.archive.UUID.
Possible Solution
Add additional case to handle wrapper lib.archive.UUID
# lib/noindent.py
from .archive import UUID as CustomUUID
#(...)
def default(self, obj):
if isinstance(obj, NoIndent):
return self.FORMAT_SPEC.format(id(obj))
elif isinstance(obj, uuid.UUID):
return str(obj)
elif isinstance(obj, CustomUUID):
return str(obj)
return super(CustomEncoder, self).default(obj)
Error
JSON Serialization error thrown when trying to save output of SaveConverter to JSON file.
Command
Error Message
Cause
Error is thrown because CustomEncoder.default expects to recieve uuid.UUID but instead recieves custom UUID wrapper lib.archive.UUID.
Possible Solution
Add additional case to handle wrapper lib.archive.UUID