Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Need help with multiprocessing.manager and passing the manager amultiprocessing.Connection

Reply
Thread Tools

Need help with multiprocessing.manager and passing the manager amultiprocessing.Connection

 
 
Metalone
Guest
Posts: n/a
 
      01-06-2010
The following code snippet is taken from the Python 2.6
multiprocessing documentation with a simple change and this change
does not work. I would like to know how to make it work or something
similar.
I want to pass a Connection object to the MathsClass.
I get the following error on Windows:

Traceback (most recent call last):
File "c:\apps\python26\lib\multiprocessing\managers.py" , line 214,
in serve_cl
ient
request = recv()
TypeError: Required argument 'handle' (pos 1) not found


from multiprocessing.managers import BaseManager
from multiprocessing import Pipe # I added this

class MathsClass(object):
def set(self, conn): # I added the set() function
self.conn = conn
def add(self, x, y):
return x + y
def mul(self, x, y):
return x * y

class MyManager(BaseManager):
pass

MyManager.register('Maths', MathsClass)

if __name__ == '__main__':
parent_conn, child_conn = Pipe() # I added this
manager = MyManager()
manager.start()
maths = manager.Maths()
print maths.add(4, 3) # prints 7
print maths.mul(7, # prints 56
maths.set(child_conn) # I added this, error is thrown here
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Web file manager and Member subscription manager gprathyushareddy@gmail.com Computer Support 3 05-19-2007 04:03 PM
Cisco CW Campus Manager, CW Common Service, CW Device Fault Manager, CW Recource Manager Essentials, NGenious RealTime Monitor, CiscoWorks Routed WAN Management Solution v1.3 [3 CDs], CiscoWorks VPN_Security Management Solution v2.2, CiscoWorks QoS P astra35 Cisco 0 05-19-2004 01:01 PM
Help!!How to upgrade campus manager 3.1 in ciscoworks 2000 LMS to campus manager 3.3? zll9527 Cisco 1 02-26-2004 01:14 AM
Cisco CW Campus Manager, CW Common Service, CW Device Fault Manager, CWRecource Manager Essentials, NGenious RealTime Monitor, CiscoWorksRouted WAN Management Solution v1.3 [3 CDs], CiscoWorks VPN_SecurityManagement Solution v2.2, CiscoWorks QoS Poli TEL Cisco 0 01-17-2004 07:09 AM
Cisco CW Campus Manager, CW Common Service, CW Device Fault Manager, CWRecource Manager Essentials, NGenious RealTime Monitor - new ! TEL Cisco 0 12-31-2003 07:03 PM



Advertisments