I create an object of class (c multiprocessing) and add it to Manager.dict()so that I can remove an element from the dictionary inside the object (the item points to) when its work is completed ..
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 have an error:
TypeError: Pickling an AuthenticationString object is disallowed
for security reasons
For curiosity, I removed the multiprocessor part and tried how:
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 does not give me any errors and displays the addresses of two objects.
What is this mistake and how to leave it?
source
share