I'm creating an object of a class(with multiprocessing
) and adding it to a Manager.dict()
so that I can delete the item from the dictionary inside the object (the item points to) when its work completes..
I tried the following code:
from multiprocessing import Manager, Process
class My_class(Process):
def __init__(self):
super(My_class, self).__init__()
print "Object", self, "created."
def run(self):
print "Object", self, "process started."
manager=Manager()
object_dict=manager.dict()
for x in range(2):
object_dict[x]=My_class()
object_dict[x].start()
But I got an error:
TypeError: Pickling an AuthenticationString object is disallowed
for security reasons
For curiosity, I removed the multiprocessing part, and tried like:
from multiprocessing import Manager
class My_class():
def __init__(self):
print "Object", self, "created."
manager=Manager()
object_dict=manager.dict()
for x in range(2):
object_dict[x]=My_class()
and it's giving me no errors and displaying the addresses of two objects.
What's that error and how to make it go away?