"Edit with IDLE" option missing from context menu - python

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 context menu. However, this option no longer appears when I right-click a .py file.
I have read numerous threads concerning this issue and attempted some of them, such as modifying/removing registry keys and then reinstalling/repairing the software. I am not interested in using an IDE at this point, though many will be happy to know I intend to use an IDE later on. Right now, the purpose is to fix the problem rather than avoid and work around it.
I appreciate the help I've gotten from the online community in the past, and I'm confident someone will come through with a solution for me.
How do I get "Edit with IDLE" back in the context menu?

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.

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!

Directly from: https://superuser.com/questions/343519/python-idle-disappeared-from-the-right-click-context-menu
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\""

Another option would be to just open the file with the idle by choosing open with:
C:\Python27\ArcGIS10.3\Lib\idlelib\idle.bat
as the default program.

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

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.

For opening your file in IDLE mode or in python exe mode u can follow this simple steps. Works for me in my windows 7 system.
For IDLE mode:
Select the file and press right mouse
press open with---->choose default program
press browse and go to the folder where your python programm is installed
in python folder search IDLE and select the batch file
press open and your file will be open in IDLE edit mode
For python.exe mode:
In command prompt write "where python"
copy the path from cmd
Select the file and press right mouse
press open with---->choose default program
press browse and go to the selected path
press open and your file will be open in IDLE edit mode

As click to save button to save your python code there will be Two Extensions...1) .py and 2) .pyw.
So for Python 2 you have to save python program using extension .pyw.

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.

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.

This issue is arising because of the problem in the registry of Python installation. While one may edit the registry and resolve the issue, the simple solution for this can be:
DELETE ALL THE REGISTRIES pertaining to the py extensions and
Re-install Python and let installation take its course of action.
The problem will definitely resolve.
Happy Programming

After uninstalling both 2.7 and 3.6, reinstalling 3.6, I ran the init.py ,main.py, and idle.pyw found in C:\Program Files\python\Lib\idlelib and the edit with menu reappeared

Related

How to enable the "idle" command from Windows Command Prompt

I remember that at some point I used to be able open up the python IDLE from the command line by simply typing "idle" return, which would pop up the python idle editor. I recently got a new machine and installed python, but have to open idle from the windows start menu.
When trying to run "idle" or "idle3" from the command line I get
C:\Users\SSims>idle3
'idle3' is not recognized as an internal or external command,
operable program or batch file.
Can anyone tell me how to get the command line "idle" command set up. Thanks for any help!
There are no step-by-step fixes that I have found online to answer this question, but many that answer specific portions of the question scattered around online. Hopefully, this will help others with the same question in the future, as I know there are many who could benefit from this answer.
If you have selected "Add Python X.x to Path Variables" upon installation then you should be able to run "python" from the command line to start the python editor. Similarly, this will allow you to do the same for IDLE.
First, hit your windows key and type "path" then enter to go to your system environment page in settings.
Next, click "Environment Variables then select "Path" under user variables
There should be a popup that contains a path that looks like this:
C:\Users\SSims\AppData\Local\Programs\Python\Python37-32\
Copy that address then click "new"
Paste that address, then at the end of it type "Lib\idlelib" so that your new variable now looks like:
C:\Users\SSims\AppData\Local\Programs\Python\Python37-32\Lib\idlelib
This should be the path to the folder in which the idle executable file resides.
Note: You can check that path to ensure it is right by pasting it into the windows start menu and it should redirect you to the folder. If it doesn't, you can paste the path to the python folder from earlier that was added automatically upon installation and search around in there until you find the idle executable, then add that folder to the Path variables to get it to work.
You should now be able to run the idle command from command prompt, hope this helps!!
Instead of IDLE use, python -m idlelib command
check the IDLE official document

cannot open python script by double clicking

i have searched on multiple forums and looks like others met similar issues but I haven't read a straightforward explanation yet. what I am trying to do is to simply open my python script by double clicking it. it used to work, but not anymore. my python scripts can still be opened via idle. and executable when it is opened and F5 pressed.
if on windows or linux, right click, open with ... select python executable, or Idle. whichever you want the default action to be.
then select the option to "always use this to open .py files"
If on a Mac, you can CTRL+Click the file, Get info > Open With and change it to Python Launcher. Click Change All. Double clicking should run the script.
Another way is to use pyinstaller which makes the script into an executable. It is pretty straightforward to use.
Change the "open with..." preference for the py files by shift + right click and choose open with from the menu. Make sure you tick the use always option

How to open PYW files in Windows 8

Someone gave me a python file to open and use as a resource. The only issue is I don't know anything about python, it's very different from my basic knowledge of coding.
The file is not a normal .py file, but rather a console-less .pyw file. I have imported the newest version of python and installed PySide, but I have had no successful attempts at opening the file.
I was wondering if someone might know how to open this kind of file? Does it need to be somewhere specific?
Right-click the file, click properties, under general it says "opens with:"...
Click the "Change" button to the right of that, and then click more options. On that menu there should be an option called "pythonw" click that. Then on the bottom-right click "apply", then "OK". Then just double-click on the file and it should run with no console window so you won't be able to see it running.

Hard times with IDLE

So I've been working with Python on my computer for about the last 2 months with no issues. Just recently however, something went wrong with IDLE. I am running python 2.5
I used to be able to right-click and select "Edit with IDLE" for a python program. That option no longer is available. When I try "open with" and navigate to the idlelib in python, I can select idle.bat, idle.py, or idle.py (no console). I've tried each option and each fails to open and returns an error that either it is not a valid Win32 application or that "Windows cannot find idle.pyw"
I am able to open IDLE on its own and use the open function in IDLE to open files, but can't open files directly using IDLE as I could before.
There was formerly the White background icon with the python logo, which is now replace by windows' logo for no program (white square, blue and red dots). I have tried to repair-install and unistall-re-install both with no success. There is no firewall or antivirus, and it was installed with permissions for all users.
Any help is much appreciated, this has been maddeningly difficult to figure out.
The native one that comes with python on windows is problematic at times, so you could uninstall and reinstall it as a solution, or open it from its directory instead of a shortcut, or get another IDE. I recommend the Ninja IDE very nice and light looking, or if you're on linux you could just use vim from terminal.
Also, if it's extremely necessary, try upgrading your python version and IDE. I think the IDE included for windows looks like a modified emacs to be honest.
The fact that Windows changed the right-context menu for .py files has nothing to do with Idle, and probably nothing to do with Python either. You are not the first to have this problem. You can potentially restore 'Edit with Idle' but without directly editing the registry (an expert option) I only knew how to do so in XP. You might also be able to fix it be going back to a restore point before it changed, but you would lose all updates since, so I would not do that.
I am surprised that re-installing did not restore it. The line was once gone for me, too, and was restored by a recent install.
I have Win7. I just now tried 'Open with', navigated to 3.4 idlelib, and selected idle.bat (the .py files were not offered as a choice). The .py file opened in an Idle editor just fine. It is now a permanent option for Open with, without having to navigate.
Idle has gotten perhaps 150 patches since 2.5. Even if you have to edit programs to run on 2.5, I strongly recommend installing a current version of Python and Idle.
I have no ideal what your comment "the programs still can't find anything associated with it, like Tkinter for example " means.

how do I launch IDLE, the development environment for Python, on Mac OS 10.7?

I am running python 2.7.1. I can't figure out how to launch the IDLE IDE. I am told it comes already installed with python, but I can't find it using spotlight.
In the stock Mac OS X python installation, idle is found in /usr/bin, which is not (easily) accessible from Finder and not indexed by Spotlight. The quickest option is to open the Terminal utility and type 'idle' at the prompt. For a more Mac-like way of opening it, you'll have to create a small app or shortcut to launch /usr/bin/idle for you (an exercise left to the reader).
When you open up a new terminal window, just type in
idle
Then you will see a little rocket icon show up as IDLE loads
Then the Python shell opens up for you to edit
I think the shell command is
python -m idlelib.idle
but i am not a mac user so i can't test.
One way to run IDLE from spotlight or an icon in the Applications folder is to build a quick Automation for it. As mentioned by other commentators, this probably isn't necessary for Python 3, as it creates a shortcut automatically, and some hand-installed versions have tools to do this automatically. But if you want to roll your own:
You'll need to know the terminal command to open your version of IDLE. On my Mac right now (early 2016), running python 2.7.10, it is "idle2.7"
Using spotlight, or in the Utilities folder, open "Automator"
Choose an "Application" type document.
Make sure "Actions" is selected in the gray bar, upper left.
In the actions column, find "Run Shell Script" and double-click it, or drag it to the workflow area on the right.
Enter the terminal command in the parameters box that appears.
Save your automation (I called mine "IDLE" and put it in the Applications folder, to make it easy).
It's now available (as soon as spotlight indexes it) via all the normal methods. The only side-effect will be that while it's running, your menu bar will have a spinning gear over in the tray area next to the clock. This indicates an automation workflow is running. Once you close IDLE, it will go away.
first to launch the terminal CMD+space
second to input idle3
the idle will be activated automatically.
After you launch idle from the command line (make sure idle shell window has focus), click File, click "New File". A new window opens; this is your editor.
Type your program in the editor. Click "File", click "Save As...". Save your file somewhere with any name you choose, and a ".py" extension to the file name.
Click "Run", click "Run Module" (or, F5). Assuming no errors, the results will appear in the Shell window. Edit your file & repeat as necessary.
The answer of Matthewm1970 works like a charm!
And if you add an & to your shell command, the automation script will end immediately. There is no spinning gear. Like so:
/usr/local/bin/idle3.5&
Note the ampersand.
Cheers.
-melle
open Terminal
type "idle" and press enter
right click on "Python" icon > Options > Keep in Dock
so for python 3.4.3 in applications a folder named "python 3.4" click that and click IDLE.
for python 2.7.9 go here https://www.python.org/downloads/ and get 2.7.9 and a folder named "python 2.7" click that and click IDLE.
As to the earlier questions about starting IDLE: you can certainly start it from the command line. Also, if you installed Python using Homebrew, you can run 'brew linkapps' (from the command line); that will place an app for IDLE (among other things) in Launchpad (Applications folder).

Categories

Resources