I am trying some webscraping. I am passing a list containing URLs to pool.starmap , and I am facing arguments error. Showing a simplified version of my code:
Can somebody help me with this? And sorry if I am doing something silly.
from multiprocessing.dummy import Pool
def func(x):
print(x)
s = ["cat","foo","bar","you","and","me"] #this list contains ~50 URLs in actual code
with Pool() as pool:
pool.starmap(func,s)
This gives me error:
Traceback (most recent call last):
File "g.py", line 8, in <module>
pool.starmap(func,s)
File "C:\Users\Gunjan\Anaconda3\lib\multiprocessing\pool.py", line 274, in starmap return
self._map_async(func, iterable, starmapstar, chunksize).get()
File "C:\Users\Gunjan\Anaconda3\lib\multiprocessing\pool.py", line 644, in get
raise self._value
File "C:\Users\Gunjan\Anaconda3\lib\multiprocessing\pool.py", line 119, in worker
result = (True, func(*args, **kwds))
File "C:\Users\Gunjan\Anaconda3\lib\multiprocessing\pool.py", line 47, in starmapstar
return list(itertools.starmap(args[0], args[1]))
TypeError: func() takes 1 positional argument but 3 were given