1

I'm learning python on x64 windows 7 machine. But after installing and uninstalling python 2.7 and 3.2 a few times too many (i just found out 3.x doesn't support some of the 3rd party libraries like PIL), i have lost .py file association(when i double click my python scripts, windows asks me to choose a program to open it with instead of making python interpret it). How can i fix the issue?

4
  • 2
    This is not a programming question. Fixing this is done the same way you'd fix it any other time you had it.
    – kindall
    Sep 23, 2012 at 17:45
  • "you'd fix it any other time you had it"??
    – user1470033
    Sep 23, 2012 at 18:06
  • 3
    double-click again, lead Windows to pythonw.exe, and check the option that tells Windows to use it for all future .py files as well.
    – alexis
    Sep 23, 2012 at 18:39
  • 1
    Possible duplicate of Association of Python files in Windows not working Feb 3, 2016 at 20:53

2 Answers 2

-1

considering you've already set the path in environment variables:

open command prompt:

cd to the directory which contains lost.py and then type:

python lost.py and hit enter.

or using IDLE:

start IDLE --> press CTRL+O --> open your file --> press F5

2
  • why the downvote?
    – Ashwini Chaudhary
    Sep 23, 2012 at 18:42
  • 4
    You got downvoted because you did not answer the question of "how do I fix my file associations" but instead answered "how do I run my python file".
    – Guvante
    Feb 16, 2016 at 18:53
0

From an elevated command prompt:

C:\Windows\System32>assoc .py=PythonFile
.py=PythonFile

C:\Windows\System32>ftype PythonFile=py.exe "%1" %*
PythonFile=python.exe "%1" %*

Notice that the "" are included in the ftype output.


Alternatively, use FileTypesMan.

You must log in to answer this question.