Open jaredforth opened 2 months ago
I am having the same issue. I also am having issues when parsing Docuemnts that have Collection within them.
I have been fidgeting with a little and sortof found a solution.
I change the serialize_json
function within the utils.py
, with the following code:
def serialize_json(obj):
try:
if isinstance(obj, datetime.datetime):
if obj.utcoffset() is not None:
obj = obj - obj.utcoffset()
millis = int(calendar.timegm(obj.timetuple()) * 1000 + obj.microsecond / 1000)
return millis
return str(obj)
except UnicodeDecodeError:
return obj.decode("utf-8", errors="ignore")
the old code looked like this:
def serialize_json(obj):
if isinstance(obj, datetime.datetime):
if obj.utcoffset() is not None:
obj = obj - obj.utcoffset()
millis = int(calendar.timegm(obj.timetuple()) * 1000 + obj.microsecond / 1000)
return millis
return str(obj)
This fixes the error or morso bypasses the problem, but there are still parts that don't work. When it runs over a list of objects, it seems unable to parse it properly and the list becomes a jumble of unicode escape sequences.
I don't know if this helps, but it will allow you to run the program without any errors.
Hello,
I'm running
python fs_to_json.py ../2024-08-27T13:49:35_42810/all_namespaces/all_kinds/ out
where../2024-08-27T13:49:35_42810/all_namespaces/all_kinds/
isThe conversion worked for 9 files but created 12 empty JSON files. Is this a known bug and are there any tips on how to resolve?