Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions redisgraph_bulk_loader/entity_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ def typed_prop_to_binary(prop_val, prop_type):
try:
numeric_prop = int(prop_val)
return struct.pack(format_str + "q", Type.LONG.value, numeric_prop)
except ValueError:
except (ValueError, struct.error):
# TODO ugly, rethink
if prop_type == Type.LONG:
raise SchemaError("Could not parse '%s' as a long" % prop_val)
Expand All @@ -58,7 +58,7 @@ def typed_prop_to_binary(prop_val, prop_type):
numeric_prop = float(prop_val)
if not math.isnan(numeric_prop) and not math.isinf(numeric_prop): # Don't accept non-finite values.
return struct.pack(format_str + "d", Type.DOUBLE.value, numeric_prop)
except ValueError:
except (ValueError, struct.error):
# TODO ugly, rethink
if prop_type == Type.DOUBLE:
raise SchemaError("Could not parse '%s' as a double" % prop_val)
Expand Down Expand Up @@ -97,15 +97,15 @@ def inferred_prop_to_binary(prop_val):
try:
numeric_prop = int(prop_val)
return struct.pack(format_str + "q", Type.LONG.value, numeric_prop)
except ValueError:
except (ValueError, struct.error):
pass

# Try to parse value as a float.
try:
numeric_prop = float(prop_val)
if not math.isnan(numeric_prop) and not math.isinf(numeric_prop): # Don't accept non-finite values.
return struct.pack(format_str + "d", Type.DOUBLE.value, numeric_prop)
except ValueError:
except (ValueError, struct.error):
pass

# If field is 'false' or 'true', it is a boolean.
Expand Down