[zeromq-dev] czmq python binding Zpoller

Johan Philips johan.philips at kuleuven.be
Tue Nov 3 22:55:57 CET 2015



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

>
> Rg,
>
> Arnaud
>
> On November 3, 2015 5:42:17 AM GMT+01:00, Johan Philips
> <johan.philips at kuleuven.be> wrote:
>
>     Hi guys
>
>     I am trying to use the Zpoller class from the python binding together
>     with the zyre binding. Following minimal example fails for me:
>
>                 from czmq import Zpoller
>                 from zyre import Zyre
>                 node = Zyre("test")
>                 node.start()
>
>     0
>
>                 poller = Zpoller(node.socket(), None)
>
>     Traceback (most recent call last):
>         File "<stdin>", line 1, in <module>
>         File "/home/jphilips/workspace/czmq/bindings/python/czmq.py <http://czmq.py>", line
>     1782, in __init__
>           self._as_parameter_ = lib.zpoller_new(args[0], *args[index()-1:]) #
>     Creation of new raw type
>     NameError: global name 'index' is not defined
>
>
>
>     There seems to be something strange going on in this zpoller_new c
>       all.
>
>     Shouldn't it be *args[-1:], i.e. without the index()?
>
>     Or how does one use this Zpoller, because I am confused at the moment :-)
>
>     Thanks!
>
>     Johan
>     ------------------------------------------------------------------------
>
>     zeromq-dev mailing list
>     zeromq-dev at lists.zeromq.org
>     http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
>
> Send from my feature bloated phone.
>
>
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>



More information about the zeromq-dev mailing list