Skip to content

Fix IndexError: strip() before checking for empty value #54

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
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
7 changes: 4 additions & 3 deletions redisgraph_bulk_loader/entity_file.py
Original file line number Diff line number Diff line change
Expand Up @@ -115,14 +115,15 @@ def typed_prop_to_binary(prop_val, prop_type):
def inferred_prop_to_binary(prop_val):
# All format strings start with an unsigned char to represent our prop_type enum
format_str = "=B"

# Remove leading and trailing whitespace
prop_val = prop_val.strip()

if prop_val == "":
# An empty string indicates a NULL property.
# TODO This is not allowed in Cypher, consider how to handle it here rather than in-module.
return struct.pack(format_str, 0)

# Remove leading and trailing whitespace
prop_val = prop_val.strip()

# Try to parse value as an integer.
try:
numeric_prop = int(prop_val)
Expand Down