Quantcast
Channel: Active questions tagged python - Stack Overflow
Viewing all articles
Browse latest Browse all 23131

Python Multiprocessing error: AttributeError: module '__main__' has no attribute '__spec__'

$
0
0

I'm using Python 3.6 and am trying to follow along with the very first example at the website below (full code also below) and am getting the below error:https://docs.python.org/3.6/library/multiprocessing.html

Error message:AttributeError: module '__main__' has no attribute '__spec__'

Full example code:

from multiprocessing import Pooldef f(x):    return x*xif __name__ == '__main__':    with Pool(5) as p:        print(p.map(f, [1, 2, 3]))

I tried Googling it and searching Stack Overflow but I've only found one other case of this error and it did not have an answer.


Viewing all articles
Browse latest Browse all 23131

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>