Skip to content
Advertisement

Multiprocessing issue on Windows 10

I am trying to collect the size of homepages of a list of sites using multiprocessing. Following is the code :

JavaScript

I am having a Windows 10 laptop with Python 3.9 running. I am not using venv.

This code goes into a loop – executes 4 times and takes 4 times longer.

What is the error here ? Can someone help ?

Thanks in advance

Sachin

Advertisement

Answer

I think you misunderstood how the pool.imap_unordered works, the provided function will be called with one of the values from the sites, whereas in your case you actually completely discard the provided url and loop on all values in the siteslist.

You should simply do

JavaScript

See the doc.

User contributions licensed under: CC BY-SA
3 People found this is helpful
Advertisement