“Edit with IDLE” option missing from context menu

前端 未结 11 1856
盖世英雄少女心
盖世英雄少女心 2020-12-09 10:46

I have Python 2.7.5 that installed with ArcGIS 10.2.2. When I first right-clicked a .py script I\'d previously written it listed the \"Edit with IDLE\" option in the contex

相关标签:
11条回答
  • 2020-12-09 10:52

    Most of the time when this problem occurs, people will read answers directing them into the windows registry, often unnecessarily.

    In the majority of cases, the registry key

    HKEY_CLASSES_ROOT\Python.File\shell\Edit with IDLE\command
    

    will already exist and have the correct value, but it will only be used by Windows shell context menu if .py files are set by default to open with python.exe.

    This is the first thing to check, and solves the problem in the majority of cases:

    • right click on a .py file
    • open with...
    • choose default program...
    • tick always use the selected program to open this kind of file
    • choose python.exe

    This runs the script in a terminal, but also sets the filetype back to python.

    Now check the right click menu again.

    0 讨论(0)
  • 2020-12-09 10:55

    I followed Teodorico Levoff's directions above, as well as Abyx's from the following page: https://superuser.com/questions/280636/trying-to-edit-a-python-file-but-the-edit-with-idle-has-disappeared-when-i-rig

    However, it only works partially. When I right-click on a .py file, no 'Edit with IDLE' shows up. Choosing 'Edit' opens the file with IDLE. Also, the python icon is not associated with .py files. I decide to associate it with Notepad, then associate it with Python again. That works the magic. The icon is back, and so is the 'Edit with IDLE' option. Hope it helps.

    0 讨论(0)
  • 2020-12-09 10:58

    As a newer update, for people that are having the "missing idle" issue with Windows 10 using Python 3.6 (64-bit).

    From my experience, this happens when you install other python editors, and you change your default app to open with that editor.

    The easiest way to fix this issue is to click the "start" button, then navigate to settings --> System --> Default Apps --> "Choose default apps by file type". Scroll down till you find ".py" file type and click on the icon and choose "Python"(has a little rocket ship in the icon). This will change your default app back to "Python.exe", and the context menu "edit with idle" will appear once again on your ".py" files.

    Hope this helps!

    0 讨论(0)
  • 2020-12-09 10:59

    I got the "Edit with IDLE" back with the option "Repair" of the deinstallation-menu.

    0 讨论(0)
  • 2020-12-09 11:05

    I think the majority of cases are caused by the Py launcher that comes with Python 3. When you install Python 3 alongside Python 2.x, the *.py and *.pyw files are associated to run with the new Py launcher. Since *.py and *.pyw files are no longer associated with Python.exe, that breaks the "Edit with IDLE" and similar context menu options, despite all relevant registry entries being present and correct.

    Right clicking a file and choosing Python.exe and selecting "always use the selected program to open this kind of file" option fixes the problem (even if Python.exe seems to be already set as the default program) but then you lose the Py launcher functionality. This may well be considered a bug with the Python 3.x installer and I think should be fixed at that level by the Python developers.

    Meanwhile, I'm sure registry wizards can find a workaround for this but unfortunately, that's beyond me at the moment.

    0 讨论(0)
  • 2020-12-09 11:06

    Adding a little more detail to Teodorico Levoff's answer for those who need a little more explanation, like myself.

    Open a text editor, such as Notepad, and copy/paste the following, but be sure to modify the paths to pythonw.exe and idle.pyw so that they match the paths in your own system:

    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\""
    

    Save this text file as idle.reg in the Python27 folder, so you now have a file that resembles this (with your own file path, of course):

    C:\Python27\idle.reg
    

    Right-click the idle.reg file, and in the context menu, click Merge. A couple instructions may appear or notices that require a Yes or Continue that I selected. In the end, my .py files give me the option to "Edit in IDLE" again.

    I hope these explanations are helpful. Big thank you to those who've solved this problem before and shared there solutions.

    0 讨论(0)
提交回复
热议问题