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 Pool
def f(x):
return x*x
if __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.
module '__main__' has no attribute '__spec__'
) when attempting to do this pytorch tutorial using Spyder. Specifically the linedataiter = iter(trainloader)
in the tutorial triggered the error. The__spec__ = None
solution below worked for me, but it seems odd that one must resort to this. Have any of the Spyder devs commented on this issue? @CarlosCordoba – Injure