From algirdas at agilitus.lt Tue Feb 28 14:13:16 2012 From: algirdas at agilitus.lt (Algirdas Brazas [Agilitus]) Date: Tue, 28 Feb 2012 15:13:16 +0200 Subject: [Multiprocessing-sig] Shared network Queue in separate thread/process Message-ID: <4F4CD2EC.3000301@agilitus.lt> Dear Sirs, Earlier I had: import Queue from processing.managers import BaseManager, CreatorMethod myQueue=Queue.Queue(50) class QueueManager(BaseManager): sms_que = CreatorMethod(callable=lambda:myQueue, typeid='my_que') m = QueueManager(address=('192.168.1.81', 50000), authkey='none') m.start() In 2.7, with rewrite to multiprocessing and .register I get "pickle.PicklingError: Can't pickle at 0x00000000028BF358>: it's not found as __parents_main__.". The code is: from multiprocessing.managers import BaseManager, Queue myQueue=Queue.Queue() class QueueManager(BaseManager): pass QueueManager.register('my_que', callable=lambda:myQueue) m = QueueManager(address=('', 50000), authkey='none') m.start() I can get it to work only with m.get_server().serve_forever(), but that is not what I need - I need the server in separate thread/process, to be able to use that Queue later. The same Queue is used by clients on the network. O to put the question otherwise - does anyone have recipe for shared network queues in 2.7? Sincerely Yours Algirdas Brazas