Couchbase
  • Why NoSQL?
  • Couchbase Server
  • Download
  • Resources
  • Careers
Home | Forums | SDKs | SDKs

"'Bucket' object has no attribute 'mc_client'" - latest python sdk broken?

17 replies [Last post]
  • Login or register to post comments
Wed, 10/03/2012 - 08:37
alexe001
Offline
Joined: 09/18/2012
Groups: None

It appears that the python sdk 0.8.0 has changed sine few weeks ago... I have two different environments with both the version 0.8.0... One was installed 3 weeks ago and one this morning. (pip install) ???

Files batch/lib/python2.7/site-packages/couchbase/__init__.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/__init__.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/client.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/client.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/constants.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/constants.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/couchbaseclient.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/couchbaseclient.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/event.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/event.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/exception.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/exception.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/logger.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/logger.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/memcachedclient.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/memcachedclient.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/__init__.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/__init__.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/migrator.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/migrator.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/migrator_couchbase.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/migrator_couchbase.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/migrator_couchdb.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/migrator_couchdb.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/migrator_csv.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/migrator_csv.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/migrator_dir.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/migrator_dir.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/migrator_json.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/migrator_json.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/migrator/migrator_zip.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/migrator/migrator_zip.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/rest_client.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/rest_client.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/util.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/util.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/utils/__init__.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/utils/__init__.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/utils/couchbase-migrator.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/utils/couchbase-migrator.pyc differ
Files batch/lib/python2.7/site-packages/couchbase/vbucketawareclient.pyc and lib-datastore/lib/python2.7/site-packages/couchbase/vbucketawareclient.pyc differ

import couchbase
cb = couchbase.Couchbase(host='localhost:8091', username='Administrator', password='password')
bucket = cb.bucket('default')

generate the following traceback:

Traceback (most recent call last):
  File "cb_test.py", line 3, in <module>
    bucket = cb.bucket('default')
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/couchbase/client.py", line 97, in bucket
    return Bucket(bucket_name, self)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/couchbase/client.py", line 196, in __init__
    self.info = rest.get_bucket(self.name)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/couchbase/rest_client.py", line 692, in get_bucket
    status, content = self._http_request(api)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/couchbase/rest_client.py", line 294, in _http_request
    auth=(self.username, self.password))
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/api.py", line 65, in get
    return request('get', url, **kwargs)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/safe_mode.py", line 39, in wrapped
    return function(method, url, **kwargs)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/api.py", line 51, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/sessions.py", line 182, in request
    params=from_key_val_list(params),
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/utils.py", line 135, in from_key_val_list
    raise ValueError('cannot encode objects that are not 2-tuples')
ValueError: cannot encode objects that are not 2-tuples
Exception AttributeError: "'Bucket' object has no attribute 'mc_client'" in <bound method Bucket.__del__ of <couchbase.client.Bucket object at 0x1009c6bd0>> ignored
<code>
 
Is this expected behavior?
Thanks.

Top
  • Login or register to post comments
Wed, 10/03/2012 - 08:51
alexe001
Offline
Joined: 09/18/2012
Groups: None

I'm confused about the sdk versions now..

On github git://github.com/couchbase/couchbase-python-client.git
there is a 0.8.0 tag that had activity about a month ago and there is a 1.8.0 that had activity about 10 months ago.
The latest branch seem to be 1.8.1. What version should be used with cb 2.0 and is the version installed with pip (0.8.0)
the "correct" one ( 0.8.0 is causing the previous issues.)?

Thanks,
A

Top
  • Login or register to post comments
Wed, 10/03/2012 - 08:57
alexe001
Offline
Joined: 09/18/2012
Groups: None

from couchbase.couchbaseclient import CouchbaseClient
client = CouchbaseClient("http://localhost:8091/pools/default", "default", "",False)

is causing the following traceback

Traceback (most recent call last):
  File "cb_test.py", line 4, in <module>
    client = CouchbaseClient("http://localhost:8091/pools/default", "default", "",False)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/couchbase/couchbaseclient.py", line 326, in __init__
    self.bucket = self.rest.get_bucket(bucket)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/couchbase/rest_client.py", line 692, in get_bucket
    status, content = self._http_request(api)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/couchbase/rest_client.py", line 294, in _http_request
    auth=(self.username, self.password))
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/api.py", line 65, in get
    return request('get', url, **kwargs)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/safe_mode.py", line 39, in wrapped
    return function(method, url, **kwargs)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/api.py", line 51, in request
    return session.request(method=method, url=url, **kwargs)
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/sessions.py", line 182, in request
    params=from_key_val_list(params),
  File "/Users/alex/Envs/lib-datastore/lib/python2.7/site-packages/requests/utils.py", line 135, in from_key_val_list
    raise ValueError('cannot encode objects that are not 2-tuples')
ValueError: cannot encode objects that are not 2-tuples

Top
  • Login or register to post comments
Wed, 10/03/2012 - 09:18
alexe001
Offline
Joined: 09/18/2012
Groups: None

in rest_client.py

line 693 you are not passing any params to the self._http_request(api)

    def get_bucket(self, bucket='default'):
        bucketInfo = None
        api = '/pools/default/buckets/{0}'.format(bucket)
        status, content = self._http_request(api)

so in line 294 you are passing an empty params to the requests call.

    def _http_request(self, api, method='GET', params='', headers=None,
                      timeout=120, base=None):
        if base is None:
            base = self.base_url
        if not headers:
            headers = self._create_headers()
        end_time = time.time() + timeout
        while True:
            try:
                api = ''.join([base, api])
                if method == 'GET':
                    print params
                    r = requests.get(api, headers=headers, params=params,
                                     auth=(self.username, self.password))

this won't work with the requests package

ValueError: cannot encode objects that are not 2-tuples

Top
  • Login or register to post comments
Wed, 10/03/2012 - 09:35
alexe001
Offline
Joined: 09/18/2012
Groups: None

Looks like the requests python module was updated and v0.14.1 broke CB SDK.
https://github.com/kennethreitz/requests/tree/v0.14.1

reverting requests to v0.14.0 solve the problem

Top
  • Login or register to post comments
Wed, 10/03/2012 - 09:56
alexe001
Offline
Joined: 09/18/2012
Groups: None

I have temporary fixed the problem and commited:

https://github.com/alex-ethier/couchbase-python-client/commit/3efcda9e99...

Top
  • Login or register to post comments
Wed, 10/03/2012 - 10:23
alexe001
Offline
Joined: 09/18/2012
Groups: None

Would love to create a bug but I can't.

http://images-shared.s3.amazonaws.com/cb_issue.jpg

Top
  • Login or register to post comments
Sun, 10/14/2012 - 11:50
AlexD
Offline
Joined: 10/13/2012
Groups: None

Same story here... tryed to submit a bug and hit same error message... is there any way to fix / workaround it?

Top
  • Login or register to post comments
Mon, 11/05/2012 - 10:18
ingenthr
Offline
Joined: 03/16/2010
Groups:

Hi Alexe001 and AlexD,

We'll have a look at the problem with Jira. Sorry for the hassle. I'll post back here.

Also, on the code commit, we have a change in already for the requests module and will be doing an update to 0.8 soon. It's been committed, we just need to change some things to get it into pypi.

Thanks,

Matt

Top
  • Login or register to post comments
Mon, 11/05/2012 - 10:20
ingenthr
Offline
Joined: 03/16/2010
Groups:

Actually, I think we fixed the Jira issue just the other day already. Again, sorry for the hassle.

Top
  • Login or register to post comments
Mon, 11/05/2012 - 16:55
saureen
Offline
Joined: 11/05/2012
Groups: None

This problem still persists even after a fresh pip install. Any clues? I don't see any updates to the git repos in the last 4-5 months.

Top
  • Login or register to post comments
Mon, 11/05/2012 - 17:12
ingenthr
Offline
Joined: 03/16/2010
Groups:

As I mentioned earlier, we're going to update pypi soon.

On the git repo update, most recent commit was 21 days ago:
https://github.com/couchbase/couchbase-python-client

Top
  • Login or register to post comments
Mon, 11/05/2012 - 17:27
saureen
Offline
Joined: 11/05/2012
Groups: None

Just for planning purposes, what is "soon"?

Top
  • Login or register to post comments
Mon, 11/05/2012 - 17:44
saureen
Offline
Joined: 11/05/2012
Groups: None

Any chance you can give me the patch so I don't have to wait for the pypy update?

Thanks.

Top
  • Login or register to post comments
Tue, 11/06/2012 - 09:41
ingenthr
Offline
Joined: 03/16/2010
Groups:

Sure, there's a workaround posted in the issue:
http://www.couchbase.com/issues/browse/PYCBC-69

(it's also linked off the download page with a note)

Top
  • Login or register to post comments
Tue, 11/06/2012 - 12:44
vdhussa
Offline
Joined: 11/06/2012
Groups: None

You'll need to make the following change as well:

- bucket.controllers = parsed['controllers']
- bucket.ddocs = parsed['ddocs']

+ bucket.controllers = parsed.get('controllers', [])
+ bucket.ddocs = parsed.get('ddocs', [])

Top
  • Login or register to post comments
Thu, 01/17/2013 - 21:04
michaels
Offline
Joined: 01/17/2013
Groups: None

I am evaluating couchbase for integration with existing django app.
coucbase server 2.0.0 on aws instance
python 2.7
couchbase 0.8.1 (pip installed)
requests 0.14.2 (have also tried 0.14.0, and 0.14.1)

Similar error posted above is blocking. No notes on the referenced jira issue since October.
Could this be a bucket configuration error?

INFO Traceback (most recent call last):
  File "/home/michael/projects/readrboard/api/decorators.py", line 15, in wrapper
    dataout = func(*args, **kwargs)
  File "/home/michael/projects/readrboard/api/decorators.py", line 52, in wrapper
    return func(self, request, data, *args, **kwargs)
  File "/home/michael/projects/readrboard/api/handlers.py", line 1002, in read
    couch.migrate()
  File "/home/michael/projects/readrboard/rb/couch.py", line 18, in migrate
    inter_bucket = get_bucket("interaction")
  File "/home/michael/projects/readrboard/rb/couch.py", line 57, in get_bucket
    bucket = couch[type]
  File "/usr/lib/python2.7/site-packages/couchbase/client.py", line 141, in __getitem__
    return self.bucket(key)
  File "/usr/lib/python2.7/site-packages/couchbase/client.py", line 97, in bucket
    return Bucket(bucket_name, self)
  File "/usr/lib/python2.7/site-packages/couchbase/client.py", line 196, in __init__
    self.info = rest.get_bucket(self.name)
  File "/usr/lib/python2.7/site-packages/couchbase/rest_client.py", line 699, in get_bucket
    error=status)
BucketUnavailableException: unable to find bucket interaction on the host @ XXX.XXX.XXX.XXX

Top
  • Login or register to post comments
Thu, 01/17/2013 - 21:25
michaels
Offline
Joined: 01/17/2013
Groups: None

Configuration problem with the client. PEBKAC.

Top
  • Login or register to post comments
  • Login or register to post comments
  • Login
  • Register

Company

  • About Us
  • Leadership
  • Customers
  • Partners
  • Contact Us

Product

  • Couchbase Server
  • Couchbase SDKs
  • Use Cases
  • Documentation
  • Forums

Open Source

  • Couchbase Project
  • Couchbase vs. CouchDB

Commercial

  • Subscriptions & Support
  • Training & Services

News

  • Blog
  • Newsletter
  • Press Releases
  • Buzz

Follow Us

    
  • Customer Login
  • Terms of Service
  • Privacy Policy
  • Trademark Policy
  • Site Map

© 2013 COUCHBASE All rights reserved.

Sign in to Couchbase Community

close
  • Create new account
  • Request new password
You are logging into the Forums, Wiki and Issue Tracker