I have object will multiple pipes (bidirectional). What i need is to wait until in any of these pipes any objects show up. Unfortunately, when i try to do something like this:
from multiprocess import Pipe
def __init__(self, pipe1, pipe2):
self.__my_pipes = [pipe1, pipe2]
ready, _, _ = select.select(self.__my_pipes, , )
#and some stuff
OSError: [WinError 10038] an operation was attempted on something that is not a socket
pipe1, pipe2 = Pipe()
pipe3, pipe4 = Pipe()
obj = MyClass(pipe1, pipe3)
w, r = os.pipe()
read, _, _ = select.select([w, r], , )
You are calling
select() with an array containing
Connection objects as used by
multiprocessing. (Btw, you were writing
multiprocess in your source, but I guess it should be
select(), however, cannot handle these.
pipe1.fileno() etc. instead; this is a file number (an int) and select is perfectly capable of working with these.
If you are working on windows, file numbers are not supported by
select() (bad luck). I cannot help then. Unless you would be willing to go multithreading and have one thread for each thing to wait on; that should also work on Windows.