Skip to content

Commit

Permalink
removing a few bytes when there's a pickling error (#96)
Browse files Browse the repository at this point in the history
  • Loading branch information
JoOkuma authored Aug 23, 2024
1 parent 1b315d8 commit 5239507
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion ultrack/core/database.py
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
import enum
import logging
import pickle
from pathlib import Path
from typing import Any, List, Union

Expand Down Expand Up @@ -39,7 +40,11 @@ def bind_processor(self, dialect):
def _process(value):
if isinstance(value, (bytes, memoryview)):
return value
return processor(value)
try:
return processor(value)
except pickle.UnpicklingError:
# for some reason, when converting database it has a few extra bytes
return processor(bytes.fromhex(value[3:].decode("utf-8")))

return _process

Expand Down

0 comments on commit 5239507

Please sign in to comment.