5

I always ran my scripts on windows by double-clicking them. However after I reinstalled my python versions this is not happenning. My python installations are on C:\Python27 and C:\Python33. PATH has C:\Python27\ in it. If I try to run a script from cmd, it works ok. But when I double-click any .py file nothing happens.

I am completely clueless as I don't use windows often for scripting. What can be the reason for that?

minerals
  • 6,090
  • 17
  • 62
  • 107
  • See also: http://stackoverflow.com/questions/26045113/making-a-python-script-executable – MackM Feb 23 '17 at 14:41

4 Answers4

5

Steps to cure this problem

1) Right click on your script.
2) Choose properties and then
3) Change the option how to open your script (set it as python).

This will make all of your .py extension scripts into running on double click in windowsenter image description here

Lalit Sachdeva
  • 6,469
  • 2
  • 19
  • 25
  • then what happens when you double click on your script. does it open in any Text Editor. or what happen when you double click. – Lalit Sachdeva Dec 11 '13 at 14:41
  • 2
    nothing happens, I can see a blue circle for a sec and then nothing. – minerals Dec 11 '13 at 14:44
  • This could be because you are not trying to print any thing on the python shell. so, it would be better if you paste your code here so we can check it and as you are saying it is processing your code that's why it showing blue circle(which is a sign of processing)! – Lalit Sachdeva Dec 11 '13 at 15:25
3

Double-clicking is not related to PATH, but extension association.

Check register extension option when you install(or recover) the python.

enter image description here

falsetru
  • 357,413
  • 63
  • 732
  • 636
  • 1
    this is what I did initially, I reinstalled it now again. No changes. I double-click the file and nothing happens. – minerals Dec 11 '13 at 14:29
2

Removed all python versions and folders. Installed WinPython-64bit-2.7.5.1 package (as before) and everything works now. I can run my scripts by double-clicking them. Really strange.

minerals
  • 6,090
  • 17
  • 62
  • 107
1

I was having the same issue. The code works in the IDLE but not on double click. I ran the script through the command prompt and it gave me an error that the IDLE didn't find. Windows didn't like the ascii characters I was printing. I removed them and the script started to work on double click again.

Deepak M
  • 11
  • 1