Closed AvnerCohen closed 4 years ago
Hey! Which is the Python 3 version exactly?
3.7.4, but quite sure this is a 3.7.x thing.
I ran the test cases in my machine with Python 3.7.5 and all tests passed.
If you manage to reproduce the issue in a test case and provide a pull request fixing the issue, I'll be happy to merge it.
@danielfm
Seems like this happened when I initiated the redis client with auto response decoding:
redis = StrictRedis.from_url(url, {'decode_responses': True})
Dropping this solved the Exception I got:
state_storage=pybreaker.CircuitRedisStorage(pybreaker.STATE_CLOSED, redis))
File "/venv/site-packages/pybreaker.py", line 61, in __init__
self._state = self._create_new_state(self.current_state)
File "/venv/site-packages/pybreaker.py", line 155, in current_state
return self._state_storage.state
File "/venv/site-packages/pybreaker.py", line 512, in state
state = state_bytes.decode('utf-8')
AttributeError: 'str' object has no attribute 'decode'
Thanks.
Glad to know. We should probably update the README to document this gotcha so other users don't waste their precious time. :)
In: https://github.com/danielfm/pybreaker/blob/945b3ff79dab76a4e820144e77cfe0bde6e0ad4f/src/pybreaker.py#L512
This fails in python 3 with:
Any plans to fix this, will a PR help on this one?