-
Notifications
You must be signed in to change notification settings - Fork 183
Open
Labels
Milestone
Description
Using riak 2.1.4 with the python client 2.5.3 with Python 3.4.3:
from riak import RiakClient
c = RiakClient(nodes=[{
'host': '127.0.0.1',
'pb_port': '8087'
}])
maps = c.bucket_type('maps')
nodes = maps.bucket('nodes')
node = nodes.new() # expecting key to be generated by riak
# ...
node.store()
It seems that the generated key is of type bytes instead of str in Python3:
Traceback (most recent call last):
File "graph.py", line 77, in <module>
node.store()
File "/home/linkdd/devel/projects/link-framework/venv3/lib/python3.4/site-packages/riak/datatypes/datatype.py", line 165, in update
self.bucket._client.update_datatype(self, **params)
File "/home/linkdd/devel/projects/link-framework/venv3/lib/python3.4/site-packages/riak/client/operations.py", line 1143, in update_datatype
include_context=include_context)
File "/home/linkdd/devel/projects/link-framework/venv3/lib/python3.4/site-packages/riak/transports/tcp/transport.py", line 505, in update_datatype
msg = codec.encode_update_datatype(datatype, **kwargs)
File "/home/linkdd/devel/projects/link-framework/venv3/lib/python3.4/site-packages/riak/codecs/pbuf.py", line 1211, in encode_update_datatype
req.key = str_to_bytes(datatype.key)
File "/home/linkdd/devel/projects/link-framework/venv3/lib/python3.4/site-packages/riak/util.py", line 118, in str_to_bytes
return value.encode(encoding)
AttributeError: 'bytes' object has no attribute 'encode'