Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

failed to set __main__.__loader__ in Python

Tags:

python

When running any Python script (by double clicking a .py file on Windows 7) I'm getting a Python: failed to set __main__.__loader__ error message. What to do?

More details:

  • The scripts work on other machines.
  • The only version of Python installed on the machine on which the scripts don't work is 3.2.
  • I get the same error when trying to run the script from the Windows shell (cmd).
  • Here's an example for the content of a file named "hey.py" that I failed to run on my machine:

    print('hey')

like image 504
snakile Avatar asked Oct 02 '12 18:10

snakile


1 Answers

I had the same problem. Turns out it was because the file was stored in a directory with a name not in English (Hebrew in my case). Make sure the path to the file contains only English letters.

http://bugs.python.org/issue16218

like image 180
mottyg1 Avatar answered Oct 19 '22 04:10

mottyg1