[zeromq-dev] pyczmq and ctx.set_linger()
Michel Pelletier
pelletier.michel at gmail.com
Thu Jan 16 21:01:10 CET 2014
Yes, pyczmq is very much a literal 1 to 1 wrapper around the czmq C
interface.
Note that there is also an "object oriented" interface:
from pyczmq import Context
c = Context()
c.set_linger(1000)
-Michel
On Thu, Jan 16, 2014 at 9:43 AM, Greg Ward <greg at gerg.ca> wrote:
> On 16 January 2014, I said:
> > after successfully using czmq for the first time yesterday, I'm now
> > trying pyczmq. (Specifically, I'm translating the "ironhouse" example
> > from Pieter's blog: http://hintjens.com/blog:49.)
> >
> > I got stumped pretty quickly:
> >
> > >>> import pyczmq
> > >>> ctx = pyczmq.zctx.new()
> > >>> ctx.set_linger(1000)
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > AttributeError: '_cffi_backend.CData' object has no attribute
> 'set_linger'
>
> Ooops, I figured it out. I was reading too much into the docs. pyczmq
> really has a C-like interface, not Python-like. Here's how it works:
>
> >>> import pyczmq
> >>> ctx = pyczmq.zctx.new()
> >>> pyczmq.zctx.set_linger(ctx, 1000)
>
> Greg
> _______________________________________________
> zeromq-dev mailing list
> zeromq-dev at lists.zeromq.org
> http://lists.zeromq.org/mailman/listinfo/zeromq-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <https://lists.zeromq.org/pipermail/zeromq-dev/attachments/20140116/d1bbf0a7/attachment.htm>
More information about the zeromq-dev
mailing list