nanomsg-python
nanomsg-python copied to clipboard
TypeError: must be str, not bytes in Python 3.3.3
I might be missing something obvious, but running the example on the site produces this error:
In [32]: %paste
from nanomsg import Socket, PAIR, PUB
s1 = Socket(PAIR)
s2 = Socket(PAIR)
s1.bind('inproc://bob')
## -- End pasted text --
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
<ipython-input-32-f1de1a8bf76f> in <module>()
2 s1 = Socket(PAIR)
3 s2 = Socket(PAIR)
----> 4 s1.bind('inproc://bob')
/home/user/environments/python3/lib/python3.3/site-packages/nanomsg-1.0a2-py3.3-linux-x86_64.egg/nanomsg/__init__.py in bind(self, address)
266 raise ValueError("Nanoconfig address must be sole endpoint")
267 endpoint_id = _nn_check_positive_rtn(
--> 268 wrapper.nn_bind(self._fd, address.encode())
269 )
270 ep = Socket.BindEndpoint(self, endpoint_id, address)
TypeError: must be str, not bytes
Since encode() will always return bytes in Python 3, will this not always fail?
I think my recent pull request fixes this.