Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

Windows 7's file association controls have been "simplified" and now I appear to be unable to change the default association of a file (in my case a Python script) to a different executable.

If I right click the script and go to "Open with...", "Choose default program", then "Browse..." and pick the desired interpreter (e.g. C:\Python27\python.exe), it reverts to another--the first--python.exe already in the "Recommended Programs" which is a 2.4 interpreter. There's a second python.exe in there as well, 2.6, but if I explicitly select that program with browse, it still reverts to the first Python in the list.

How do I get back the power of XP?

share|improve this question
up vote 4 down vote accepted

You can try free Default Programs Editor. I have a good experience with it.

enter image description here

share|improve this answer
    
Excellent application – Factor Mystic Feb 5 '12 at 21:03

You could always make the change in the registry under:

HKEY_CLASSES_ROOT and HKEY_CURRENT_USER\Software\Classes

But I would highly recommend the program Types from Sourceforge for control over all parts of the association process.

share|improve this answer
    
I had the same problem with Sublime Text 2 and 3 (both use sublime.exe name) and I fixed the problem by changing the HKEY_CURRENT_USER\Software\Classes then navigating to the bottom key and changing the path manually, thanks! – dominicbri7 Sep 2 '15 at 15:16

Its a workaround, but change the name of the 2.4 python.exe, then try to run a .py. It should though a file not found error. Then browse to the correct file. Feel free to rename the original 2.4 python.exe back to its former name.

share|improve this answer

I would use Creative Elements Power Tools, specifically the "File Type Doctor".

http://www.creativelement.com/powertools/#download (to download)

http://forums.techarena.in/tips-tweaks/989159.htm (for a screenshot)

This has the advantage of looking almost exactly like the XP file association area, so you would be familiar with it.

share|improve this answer
    
I am not sure about how this will interact with your python.exe program, but it does give you back the power of XP, as you asked. – KCotreau Jul 14 '11 at 2:47

Are you sure you are enabling the "Always use the selected program to open this kind of file" check box to the left of the browse button?

enter image description here

This problem shouldn't happen, otherwise. And I can't remember ever witnessing anything similar.

share|improve this answer
    
Yes, it is checked, and I don't even have to click "OK" to dismiss the program selection window and it "reverts", highlighting the 2.4 python.exe – Nick T Jul 14 '11 at 2:49
    
Thanks for having replied, Nick. This behavior definitely qualifies as a Windows bug. I'll report it, next opportunity. – A Dwarf Jul 14 '11 at 3:09

Apart from the manual way to change associations for all relevant extensions described in Juhele's answer, there's a way specifically for Python:

Control panel -> Add or remove programs -> <current default Python installation> -> Change

In the installation wizard that appears, select Change Python <version>. Then the list of installed features appears. We're interested in "Register extensions" (governs double-click action) and "Add python.exe to PATH" (what typing python in console runs):

feature list

You need to uncheck these features for the current default installation and check them for the one you wish to switch to.

This is more manageable a way than editing PATH/associations by hand: this way, you're safe from nasty surprises:

  • the stock file type association wizard may only change the association for the current user
    • then upgrading your installation won't affect the overridden associations
  • when installing/upgrading, the installation wizard acts according to its records and may leave side effects/leftovers if you did something funny without telling it
share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.