Skip to content

Error on binding sockets in python 3.6 #61

@DanielRoitenberg

Description

@DanielRoitenberg

Hi.

I have tried to run a code that binds a socket in python2.7 in python3.6:
from nanomsg import REP, Socket, PAIR a = Socket(REP) a.bind("ipc://bla")

On python 2.7 the code works yet the output in python3.6 is:
/usr/local/lib/python3.6/dist-packages/nanomsg_wrappers/__init__.py:22: UserWarning: Could not load the default wrapper for your platform: cpy, performance may be affected! "%s, performance may be affected!") % (default,)) Traceback (most recent call last): File "engine.py", line 5, in <module> a.bind("ipc://bla") File "/usr/local/lib/python3.6/dist-packages/nanomsg/__init__.py", line 273, in bind wrapper.nn_bind(self._fd, address) ctypes.ArgumentError: argument 2: <class 'TypeError'>: wrong type

I stumbled an old issue : #13
And according to it I changed the code to
from nanomsg import REP, Socket, PAIR a = Socket(REP) a.bind("ipc://bla".encode())

It seems to fix it.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions