Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'bytes' object has no attribute 'get' when Consul in leaderless state #96

Open
daf opened this issue Oct 18, 2016 · 0 comments
Labels
Milestone

Comments

@daf
Copy link

daf commented Oct 18, 2016

On Python 3.5.2 / consulate 0.6 I was seeing an intermittent error:

    ...
      File "/app/__init__.py", line 65, in consul_lock
        sid = consul.session.create(session_name, ttl=ttl)
      File "/opt/conda/lib/python3.5/site-packages/consulate/api/session.py", line 67, in create
        return self._put_response_body(['create'], None, payload).get('ID')
    AttributeError: 'bytes' object has no attribute 'get'

After splicing in a debug print(self._put_response_body(['create'], None, payload)), it would tell me this:
*** DEBUG <class 'bytes'> : b'No cluster leader'.

This indicated problems with my consul setup, and I was able to simply restart all my instances as this is the only application they are currently used for. I'm not sure what the proper handling should be in this case, but something to handle the case where the response body isn't a dict seems needed.

@gmr gmr added the bug label Mar 1, 2018
@gmr gmr added this to the 1.0.0 milestone Mar 1, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants