You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
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'
The text was updated successfully, but these errors were encountered:
Basho-JIRA
changed the title
Error when generating object keys
Error when generating object keys [JIRA: CLIENTS-900]
Jun 21, 2016
OK. I asked because there is an integration test that tests a Riak-generated key on a non-datatype bucket, but I couldn't find something for a bucket configured for a datatype. I suspect that's the issue.
Using riak 2.1.4 with the python client 2.5.3 with Python 3.4.3:
It seems that the generated key is of type
bytes
instead ofstr
in Python3:The text was updated successfully, but these errors were encountered: