Python: More problems with counters

Eric Redmond eredmond at basho.com
Sun Aug 17 14:04:45 EDT 2014


Alex,

looking through your previous emails, it looked like you created a bucket type named "likes". If that's the case, you'd swap the function params:

bucket = client.bucket_type('likes').bucket('counter_bucket')

Hope that helps,
Eric


On Aug 17, 2014, at 10:33 AM, Alex De la rosa <alex.rosa.box at gmail.com> wrote:

> Hi there,
> 
> I was able to install the latest python client version with "pip install riak==2.1.0rc1", however, counters still fails to work... I used the following code ( that is the same as in the documentation ):
> 
> bucket = client.bucket_type('counter_bucket').bucket('likes')
> 
> however I get the following error:
> 
> Traceback (most recent call last):
>   File "x.py", line 18, in <module>
>     counter = bucket.new('Barcelona')
>   File "/usr/local/lib/python2.7/dist-packages/riak/bucket.py", line 159, in new
>     if self.bucket_type.datatype:
>   File "/usr/local/lib/python2.7/dist-packages/riak/util.py", line 78, in __get__
>     value = self.fget(obj)
>   File "/usr/local/lib/python2.7/dist-packages/riak/bucket.py", line 618, in datatype
>     return self.get_properties().get('datatype')
>   File "/usr/local/lib/python2.7/dist-packages/riak/bucket.py", line 557, in get_properties
>     return self._client.get_bucket_type_props(self)
>   File "/usr/local/lib/python2.7/dist-packages/riak/client/transport.py", line 184, in wrapper
>     return self._with_retries(pool, thunk)
>   File "/usr/local/lib/python2.7/dist-packages/riak/client/transport.py", line 126, in _with_retries
>     return fn(transport)
>   File "/usr/local/lib/python2.7/dist-packages/riak/client/transport.py", line 182, in thunk
>     return fn(self, transport, *args, **kwargs)
>   File "/usr/local/lib/python2.7/dist-packages/riak/client/operations.py", line 265, in get_bucket_type_props
>     return transport.get_bucket_type_props(bucket_type)
>   File "/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/transport.py", line 381, in get_bucket_type_props
>     MSG_CODE_GET_BUCKET_RESP)
>   File "/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py", line 50, in _request
>     return self._recv_msg(expect)
>   File "/usr/local/lib/python2.7/dist-packages/riak/transports/pbc/connection.py", line 142, in _recv_msg
>     raise RiakError(err.errmsg)
> riak.RiakError: 'Invalid bucket type: <<"counter_bucket">>'
> 
> It says the bucket type is wrong (but is the same as in the documentation)... I tried other combinations and all of them failed too:
> 
> riak.RiakError: 'Invalid bucket type: <<"counters_bucket">>'
> riak.RiakError: 'Invalid bucket type: <<"counters">>'
> riak.RiakError: 'Invalid bucket type: <<"counter">>'
> 
> so... no plural, no singular, not isolated... which is the correct "bucket_type" to use then??
> 
> Thanks!
> Alex
> _______________________________________________
> riak-users mailing list
> riak-users at lists.basho.com
> http://lists.basho.com/mailman/listinfo/riak-users_lists.basho.com





More information about the riak-users mailing list