Hi, This is a bug. I fixed some problems in poll, but forgot to update select. Could you file a ticket on the github page for pyzmq?
select should work like you are expecting and it is probably a trivial fix. I will try to get to this soon, but if you want to have a stab and fixing it, go for it. Thanks Brian On Mon, Apr 12, 2010 at 10:58 AM, Laurens Van Houtven <[email protected]> wrote: > Hey, > > > > I'm running into trouble using zmq.select instead of select.select. The end > goal is to get something based on select (specifically, twisted) to be able > to read from ZMQ sockets as well as plain old file descriptors. In a naive > attempt to get that to work, I tried this: > > http://bpaste.net/show/5455/ > > So, I started investigating. Consider the following Python function, in > _zmq.pyx: http://paste.pocoo.org/show/201079/ > > The sockets list, used as an argument to _poll, is clearly an iterable of > things that can live in {r,w,x}list, so, either: > - zmq.Socket > - int (an fd) > - object implementing fileno returning an int > > However, _poll says in its docstring that its sockets argument should be a > list of tuples of (socket, flags). Look at its implementation > (http://paste.pocoo.org/show/201080/, sorry, no syntax highlighting -- I > couldn't find a pastebin that does that for Cython), specifically lines 22 > and 23. It appears that _poll isn't lying in its docstring, so it appears > that select isn't feeding it what it wants. > > This results in the following problem if I try to use select-using code, but > select.select replaced with zmq.select: > > http://bpaste.net/show/5455/ > > The problem is that in the two aforementioned lines, _zmq.pyx tries to do > sockets[i][0], but sockets[i] is just an integer (specifically, a fd) > > What am I missing? The obvious fix of appending (s, flags) instead just > seems a tad *too* obvious. Is zmq.select even supposed to work like this? > > tia > lvh > > _______________________________________________ > zeromq-dev mailing list > [email protected] > http://lists.zeromq.org/mailman/listinfo/zeromq-dev > > -- Brian E. Granger, Ph.D. Assistant Professor of Physics Cal Poly State University, San Luis Obispo [email protected] [email protected] _______________________________________________ zeromq-dev mailing list [email protected] http://lists.zeromq.org/mailman/listinfo/zeromq-dev
