Take the 2-minute tour ×
Super User is a question and answer site for computer enthusiasts and power users. It's 100% free, no registration required.

Trying to edit a python file but the "edit command" has disappeared all of a sudden when i right click the file. How do I restore the edit command so i can continue working on my python files? I am using windows vista.

Thanks!

share|improve this question

migrated from stackoverflow.com May 8 '11 at 8:13

This question came from our site for professional and enthusiast programmers.

    
possible duplicate of Getting .py scripts to open up in Python's IDLE –  Revolter Jun 29 '12 at 9:45

6 Answers 6

What exactly do you mean by the right click "edit command"? How did you originally install python and run and edit python files, which editor etc?

Have you considered using an IDE? I find that for development using eclipse IDE with pyDev is really good. Either that or pyscripter is fairly well known - http://code.google.com/p/pyscripter/downloads/list

If you want to continue as you were, try re-installing python, each version comes bundles with the Python IDLE which I expect is what you were using. - http://www.python.org/getit/

Then it should come back. If that fails:

  1. Search in regedit for the key: HKEY_CLASSES_ROOT*\shell
  2. Right click on "shell" and choose 'create new key'
  3. Name it "Edit with IDLE"
  4. Create a key below that and call it "command."
  5. Double click on the (Default) value that you will find in the right hand window pane, then type in the following: "python.exe %1" (or if you don't have it in your PATH, then put in the absolute python directory, for example: C:\Python27\bin\python.exe)

See some more links below for IDEs Editors etc:

http://wiki.python.org/moin/IntegratedDevelopmentEnvironments

Poll: Which Python IDE/editor is the best?

Is there a good, free Python IDE for Windows?

share|improve this answer
    
Hi Peter, so as an example, I have created and saved a python file. Lets call it test.py. I now would like to edit that file in idle. So normally i go to the file on my desktop and right click the file which opens up a menu that include edit. I then press edit which opens the file so i can making the necessary changes to the code. –  Anonymous May 7 '11 at 21:00
    
I have updated my answer to help you add back the "Edit with IDLE" command. I realised you were probably just using IDLE. –  Peter Hamilton May 7 '11 at 21:01
    
Peter i re installed python and still the "edit with IDLE" command does not show up. So i tried your steps above but i do not know what is regedit and how to find it. Could you please explain? –  Anonymous May 7 '11 at 22:15
    
Type regedit in the vista Start > Search Dialog Box and press enter –  Peter Hamilton May 7 '11 at 22:47
    
Okay tried your instructions above and did not work. When you say Create a key below that and call it "command.". Do you mean create a subfolder within edit with IDLE?. Because thats what i did. Also, should it automatically appear or would i have to do something else after following your instructions. –  Anonymous May 8 '11 at 1:37

Sounds like you're using Windows. You need to associate IDLE as the editor for .py files. I don't know about Windows 7 but with XP:

  • Open Windows Explorer, click on 'Tools' menu, select 'Folder Options'
  • Select 'File types' tab.
  • Scroll down and select "py Python File" in the Registered file type list.
  • Click the Advanced button to open the Edit File Type dialog box.
  • If you see "Edit with IDLE", click the Edit button and make sure the "Application used" box reads something like "C:\PythonXX\pythonw.exe" "C:\PythonXX\Lib\idlelib\idle.pyw" -e "%1" (replacing XX with your Python version.
  • If you don't see "Edit with IDLE", click the New button, enter "Edit with IDLE" in the Action box and the same "Application used" string as above, then check the DDE box.
share|improve this answer

In Windows7 you can create the
HKEY_CLASSES_ROOT\SystemFileAssociations\.py\shell\edit\command
path and set its default value to
c:\python\pythonw.exe c:\python\Lib\idlelib\idle.pyw -e %1

share|improve this answer

I spent some time trying to figure this out. i finally got it. I'm running windows 7, but should be the same for vista, XP etc.

  1. uninstall python
  2. open registry (windows button+r, then type regedit and hit enter)
  3. push ctrl+f and type .py
  4. each .py key you come across, delete it.
  5. do this until it gives you the message: finished searching the registry

repeat this process but changing the search for the following querys:

.pyw
python
python.exe
pythonw.exe
  • delete them all.
  • log off from your user account
  • log back on
  • re-install python
share|improve this answer
    
While I am sure this will work, hence the +1, it is a bit along the lines of "nuke it to the bedrock and start from scratch" –  Mokubai Jun 14 '12 at 16:43

Right click on the file, choose Open with, select choose default program, and select python.

Warning, this will attempt to run whatever script you are trying to open from the command prompt (but you can just x this out).

After that, the computer should recognize the file as a python file and give you the "Edit with Idle" option again.

share|improve this answer

In your registry find this entry:

HKEY_LOCAL_MACHINE\SOFTWARE\Classes\Python.File\shell\Edit with IDLE\command

and replace the path to pythonw.exe with the path of the version you want to use by default. I'm guessing this path might have been pointing to something that no longer exists for OP.

share|improve this answer

Your Answer

 
discard

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