Am getting this error when using the pool.map(funct, iterable)
:
AttributeError: __exit__
No Explanation, only stack trace to the pool.py file within the module.
using in this way:
with Pool(processes=2) as pool:
pool.map(myFunction, mylist)
pool.map(myfunction2, mylist2)
I suspect there could be a problem with the picklability (python needs to pickle
, or transform list data into byte stream) yet I'm not sure if this is true or if it is how to debug.
EDIT: new format of code that produces this error :
def governingFunct(list):
#some tasks
def myFunction():
# function contents
with closing(Pool(processes=2)) as pool:
pool.map(myFunction, sublist)
pool.map(myFunction2, sublist2)
ERROR PRODUCED:
PicklingError: Can't pickle <type 'function'>: attribute lookup __builtin__.function failed