Python IDLE disappeared from the right click context menu

10

4

My IDLE shortcut in the right click menu has disappeared. I think it's because I used to use Python 2.7, but I installed Python 2.5 without uninstalling Python2.7, and then uninstalled Python 2.5. I found one file named idle.bat, and it works, but that isn't a good way to solve this problem.

Jimmy Lin

Posted 2011-10-06T02:04:03.363

Reputation: 203

You could try to uninstall Python using Revo Uninstaller Freeware, clean up the registry via CCleaner free, then reinstall Python.

– harrymc – 2014-12-04T07:28:54.500

I though this is because I installed two Python in my computer, then I remove one. Maybe I should try keyword like "How to insert shortcut into right-click menu". Anyway thanks for your help. – None – 2011-10-06T03:35:53.697

That probably is the reason it went missing, but your question is how to fix it – Michael Mrozek – 2011-10-06T04:23:01.237

Answers

6

Here's a reg file to add the command to edit with IDLE for Python.File (.py) and Python.NoConFile (.pyw) file types. It's for Python 2.7, installed in C:\Python27, so substitute the paths to pythonw.exe and idle.pyw that are relevant to your installation. Save it to a .reg file. Then right-click and choose Merge.

Windows Registry Editor Version 5.00

[HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command]
@="\"C:\\Python27\\pythonw.exe\" \"C:\\Python27\\Lib\\idlelib\\idle.pyw\" -e \"%1\""

[HKEY_CLASSES_ROOT\Python.NoConFile\shell\Edit with IDLE\command]
@="\"C:\\Python27\\pythonw.exe\" \"C:\\Python27\\Lib\\idlelib\\idle.pyw\" -e \"%1\""

Eryk Sun

Posted 2011-10-06T02:04:03.363

Reputation: 236

To make this work I had to right click a .py file -->open with --> change default program to anything --> then change it back to pythonw.exe and finally the context menu items showed up – user2682863 – 2015-09-02T17:13:50.093

@user2682863, a .py file should open with python.exe, not pythonw.exe. Also, using Explorer to create the association probably broke passing command-line arguments to Python scripts (e.g. running script.py arg1 arg2). Make sure .py is associated with the Python.File type, which should be set to something like "C:\Python27\python.exe" "%1" %*. – Eryk Sun – 2015-09-02T17:35:57.460

Yeah I verified it in the registry. Everything looked fine. It worked fine with .pyw files but this is the only way I could get .py files to work – user2682863 – 2015-09-02T17:39:56.130

Hi, I used another way to add the right-click command, but it apply to all my files. Actually, I just want to apply to *.py file. How can I delete the right-click command I added before ? Then I can add your command. Thank you. – Jimmy Lin – 2011-10-06T11:19:51.607

@Jimmy: You can use regedit to inspect HKCR\*\shell, HKCR\*\shellex, HKCR\AllFilesystemObjects\shellex, and so on. This is tedious if you don't find the culprit quickly. Or try a a context menu editor such as ShellMenuView and ShellExView.

– Eryk Sun – 2011-10-06T12:03:15.660

Hi, I find the command in the redgit and delete, but I still can't add the right-click command by these two command. I don't know why. I just want to add the command on the right-click menu of *.py and *.pyw file. Thanks again. – Jimmy Lin – 2011-10-07T08:27:55.013

@Jimmy: When you save the above to say idle.reg and right-click the file idle.reg, do you see the option 'Merge'? If that seems to work fine and you confirm that the settings were added, then open a command prompt and check that the output of assoc .py is .py=Python.File. – Eryk Sun – 2011-10-07T10:52:39.923

Hi,actually I didn't see the idle.pyw. I see the idle.bat, so I replace idle.bat with idle.pyw. – Jimmy Lin – 2011-10-11T09:57:14.190

@Jimmy: Reinstall if there's no idle.pyw in the idlelib directory. Make sure to install Tk. idle.bat is a Windows batch file that starts idle.pyw. If idle.pyw were missing, the batch file would fail. – Eryk Sun – 2011-10-11T10:53:11.973

2

This worked for me:


(Also view: edit with idle (python gui) context menu windows-7)

  1. open regedit
  2. go to [HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command], if it doesn't exist create it.
  3. copy the following line into the registry:

    "C:\Python27\pythonw.exe" "C:\Python27\Lib\idlelib\idle.pyw" -e "%1"

  4. go to [HKEY_CLASSES_ROOT\Python.NoConFile\shell\Edit with IDLE\command], if it doesn't exist create it.

  5. copy the same line in the the registry:

    "C:\Python27\pythonw.exe" "C:\Python27\Lib\idlelib\idle.pyw" -e "%1"

Note: if your python path is different (e.g. c:/program files/...) then change the paths to match the pythonw.exe and idle.pyw file locations.

This should also work for a clean ActivePython install (to give you that classic idle feel!).

DrBailey

Posted 2011-10-06T02:04:03.363

Reputation: 21

0

I had the exact same scenario and my fix was to re-run the installer for the current version of python that you have and choose the "repair" option.

Zach

Posted 2011-10-06T02:04:03.363

Reputation: 1