Reputation: 2700
I used to have the Edit with IDLE
option when I right-clicked on .py
files but I uninstalled/reinstalled multiple times to get some stuff working and now it's gone. I checked the registry under HKEY_CLASSES_ROOT
and HKEY_LOCAL_MACHINE
for value under Python.File
and Python.NoConFile
and it is "C:\Python27\pythonw.exe" "C:\Python27\Lib\idlelib\idle.pyw" -e "%1"
so I am not sure why it isn't working. It works for .pyw
files though. Can someone help me get this working again? I've also tried repairing my python installation to no avail and following Python IDLE disappeared from the right click context menu.
Upvotes: 3
Views: 8104
Reputation: 1
I also downloaded python 3-4 times, but I realised that you must choose to open .py files with python launcher, the icon with the spaceship.
This solved my problem, I hope it will also solve yours.
Upvotes: 0
Reputation: 1
I have been using python 3.6, and ran into this issue after installing (and later removing) python 2.7 (Thankfully i had another machine with a clean install)
To restore "Edit with IDLE" / file icons / open option:
Make a .reg file with the following, right-click it, and choose 'merge':
( NOTE: "C:\WINDOWS\py.exe" should be correct, but double check that the .exe is there first)
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\.py]
@="Python.File"
"Content Type"="text/plain"
[HKEY_CLASSES_ROOT\Python.File]
@="Python File"
[HKEY_CLASSES_ROOT\Python.File\DefaultIcon]
@="\"C:\\WINDOWS\\py.exe\",1"
[HKEY_CLASSES_ROOT\Python.File\Shell]
[HKEY_CLASSES_ROOT\Python.File\Shell\editwithidle]
"MUIVerb"="&Edit with IDLE"
"Subcommands"=""
[HKEY_CLASSES_ROOT\Python.File\Shell\editwithidle\shell]
[HKEY_CLASSES_ROOT\Python.File\Shell\open]
[HKEY_CLASSES_ROOT\Python.File\Shell\open\command]
@="\"C:\\WINDOWS\\py.exe\" \"%L\" %*"
[HKEY_CLASSES_ROOT\.pyw]
@="Python.NoConFile"
"Content Type"="text/plain"
[HKEY_CLASSES_ROOT\Python.NoConFile]
@="Python File (no console)"
[HKEY_CLASSES_ROOT\Python.NoConFile\DefaultIcon]
@="\"C:\\WINDOWS\\py.exe\",1"
[HKEY_CLASSES_ROOT\Python.NoConFile\Shell]
[HKEY_CLASSES_ROOT\Python.NoConFile\Shell\editwithidle]
"MUIVerb"="&Edit with IDLE"
"Subcommands"=""
[HKEY_CLASSES_ROOT\Python.NoConFile\Shell\editwithidle\shell]
[HKEY_CLASSES_ROOT\Python.NoConFile\Shell\open]
[HKEY_CLASSES_ROOT\Python.NoConFile\Shell\open\command]
@="\"C:\\WINDOWS\\pyw.exe\" \"%L\" %*"
Adding/Fixing versions to the menu:
Here is an example .reg for IDLE 3.6 32 bit, where the █'s are the path to the install (use double \'s)
for other versions change "Edit with IDLE 3.6 (32-bit)" and edit36-32 to match your version
Windows Registry Editor Version 5.00
[HKEY_CLASSES_ROOT\Python.File\Shell\editwithidle\shell\edit36-32]
"MUIVerb"="Edit with IDLE 3.6 (32-bit)"
[HKEY_CLASSES_ROOT\Python.File\Shell\editwithidle\shell\edit36-32\command]
@="\"███████████████\\pythonw.exe\" -m idlelib \"%L\" %*"
[HKEY_CLASSES_ROOT\Python.NoConFile\Shell\editwithidle\shell\edit36-32]
"MUIVerb"="Edit with IDLE 3.6 (32-bit)"
[HKEY_CLASSES_ROOT\Python.NoConFile\Shell\editwithidle\shell\edit36-32\command]
@="\"███████████████\\pythonw.exe\" -m idlelib \"%L\" %*"
Upvotes: 0
Reputation: 11
i suggest that i've got a better way to solve this problem. right click at the .py file, open with, choose another app, more apps and make sure to check the check box that says 'always use this app to open .py files', then look for another app on this pc, a window explorer will open. then choose this file C:\Python34\Lib\idlelib\idle.bat One more thing, the icon for python files(python logo disappears) which i don't like. but any way the python file will be open in python IDLE editor, with just one click(i set my mouse to one click from double click).
Thank you for reading my suggestion
Upvotes: 1
Reputation: 19144
This sort of thing can be Windows version and Python version specific, and maddening to fix. There are extensions, abstract file types, and executables. For me, with Windows 10 and 3.5.1, assoc
in Command Prompt returns a list of .xyz associations that includes
.py=Python.File
.pyc=Python.CompiledFile
.pyo=Python.CompiledFile
.pyw=Python.NoConFile
.pyz=Python.ArchiveFile
.pyzw=Python.NoConArchiveFile
assoc .py=Python.File
will set an association. Once these are set correctly, there is still the issue of mapping abstract file types to executable commands. Mark Ch's answer address this part.
Upvotes: 2
Reputation: 3030
This usually happens because a .py file has been opened in a text editor and accidentally set the default "open with" option to something other than python.
Try:
This runs the script in a terminal, but also sets the filetype back to python.
Now check the right click menu again.
...
And for those people thinking *durr it's not that simple*, just try it first - It might prevent you from hacking about in the registry for no reason!
Upvotes: 3