0

As I'm trying to store a PNG image file into my riakBucket. As per https://riak-python-client.readthedocs.io/en/1.5-stable/tutorial.html documentation described here actually using riakBucketObject.new_binary().

But when I'm trying to do this over my system, this error is pop-up:

My python script is :

>>> import riak
>>> myClient = riak.RiakClient(pb_port=8087, protocol='pbc')
>>> photo_bucket = myClient.bucket('photo-bucket')
>>> file_data = open('/home/kamli/Pictures/Store3.png','rb').read()
>>> key = photo_bucket.new_binary('myphoto', data=file_data, content_type='image/png')

But error is :

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
AttributeError: 'RiakBucket' object has no attribute 'new_binary'

System Configuration:

Python version - 2.7.6
Riak Version - 2.2.0

2 Answers2

2

Riak 2.2 has changed since 1.5 and the current method to get a new RiakObject from a bucket is simply using RiakBucket.new() or RiakBucket.new_from_file(). The documentation can be found on their readthedocs website. Look for the version switcher near the bottom to look at documentation for each major release.

Aaron3468
  • 1,734
  • 16
  • 29
1

In addition to what Aaron3468 said, I would like to mention that the Riak Python Client's version does not match Riak's version. The client is versioned according to semver and the latest release is available here.

Please use the latest documentation.

Luke Bakken
  • 8,993
  • 2
  • 20
  • 33