Process PoolWorker-1:
Traceback (most recent call last):
File "C:\Python27\lib\multiprocessing\process.py", line 258, in _bootstrap
self.run()
File "C:\Python27\lib\multiprocessing\process.py", line 114, in run
self._target(*self._args, **self._kwargs)
File "C:\Python27\lib\multiprocessing\pool.py", line 102, in worker
task = get()
File "C:\Python27\lib\site-packages\joblib\pool.py", line 362, in get
return recv()
AttributeError: 'module' object has no attribute 'easysearch'
how to solve this bug?
import re
import string
from itertools import permutations
from itertools import combinations
from joblib import Parallel, delayed
import multiprocessing
from multiprocessing import Process, freeze_support
all_normal_characters = string.ascii_letters + string.digits
def is_special(character):
return character not in all_normal_characters
def easysearch(content):
if len(str(content[0]).strip()) == 0 or len(str(content[1]).strip()) == 0:
return ""
row1 = content[0]
keywords = content[1]
.......
num_cores = multiprocessing.cpu_count()
def segmentsearch(content, findwhat, lensize):
chunks, chunk_size = len(content), lensize
result =
Parallel(n_jobs=num_cores)(delayed(easysearch)([content[j:j+chunk_size],
findwhat]) for j in range(0, chunks, chunk_size))
print(result)
return result
def main():
result = segmentsearch("search key $ @ $ wrds today", "key words",
77)
print(result)
if __name__=="__main__":
freeze_support()
main()
--
https://mail.python.org/mailman/listinfo/python-list