[zeromq-dev] czmq python binding Zpoller

Arnaud Loonstra arnaud at sphaero.org
Wed Nov 4 10:38:29 CET 2015


On 2015-11-03 22:55, Johan Philips wrote:
> On 2015-11-03 19:31, Arnaud Loonstra wrote:
>> I think you are right. Have you tried removing index().
>
> Yes and that silences the error but how can I add 2 sockets to the
> poller? Is the only way by using the 'add' method?
>
> In zpoller (the C version) you could stack them in the constructor. 
> i.e.
> zpoller_new(socket1, socket2, NULL)
>
> In python this results in:
>
> Traceback (most recent call last):
>    File "zyre_test.py", line 12, in <module>
>      poller = Zpoller(n1,n2,None)
>    File "/home/jphilips/workspace/czmq/bindings/python/czmq.py", line
> 1781, in __init__
>      assert(len(args) == 2)
> AssertionError
> Exception AttributeError: "'Zpoller' object has no attribute
> 'allow_destruct'" in <bound method Zpoller.__del__ of <czmq.Zpoller
> object at 0x7f53f7a6d590>> ignored

Ah I understand it now. You get an assertion error in the constructor 
before the
allow_destruct bool can be set. So in the destructor you get another 
error because the
allow_destruct isn't set. So the first error is a bug, the second can 
be blamed on python
allowing dynamic types. We could prevent it by assigning allow_destruct 
earlier but it
shouldn't be a problem. I think it is fixed here 
https://github.com/zeromq/zproject/pull/271

The binding for czmq is updated as well. Just pull from the latest 
master.

Rg,

Arnaud



More information about the zeromq-dev mailing list