Skip to content

Commit a7f7507

Browse files
committed
Compatibility with Python 3.x
1 parent 37fb840 commit a7f7507

File tree

1 file changed

+4
-4
lines changed

1 file changed

+4
-4
lines changed

bulk_insert.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ def __init__(self, prop_str):
5656
# If we've reached this point, the property is a string
5757
self.type = Type.STRING
5858
self.format_str += "%ds" % (len(prop_str) + 1)
59-
self.pack_args = [prop_str]
59+
self.pack_args = [str.encode(prop_str)]
6060

6161
def to_binary(self):
6262
return struct.pack(self.format_str, *[self.type] + self.pack_args)
@@ -87,18 +87,18 @@ def pack_header(self, header):
8787
args = [self.entity_str, prop_count]
8888
for prop in header[self.prop_offset:]:
8989
fmt += "%ds" % (len(prop) + 1)
90-
args += [prop]
90+
args += [str.encode(prop)]
9191
return struct.pack(fmt, *args)
9292

9393
def pack_props(self, line):
9494
props = []
9595
for field in line[self.prop_offset:]:
9696
props.append(Property(field))
9797

98-
return "".join(p.to_binary() for p in props)
98+
return b''.join(p.to_binary() for p in props)
9999

100100
def to_binary(self):
101-
return self.packed_header + "".join(self.entities)
101+
return self.packed_header + b''.join(self.entities)
102102

103103
class NodeFile(EntityFile):
104104
def __init__(self, infile):

0 commit comments

Comments
 (0)