Associate Python Files with IDLE

To make it easier to open files directly into IDLE from Windows Explorer, you can associate all Python files with IDLE in Windows. As IDLE doesn’t come up as one of the default options for editing Python, it’s not as intuitive as it might be, but it’s pretty simple. Here’s how you do it:

To associate Python files with IDLE on Windows:

  1. Go to a folder that contains a Python file.
  2. Right-click on any Python file.
  3. Select Properties.
  4. Next to the section that says “Opens with”, click the Change button.
  5. You may need to select More Options.
  6. Click Look for another app on this PC.
  7. Navigate to where you installed Python. If you don’t know where that is, see How to find all your Python installations on Windows.
  8. Open Lib
  9. Open idlelib
  10. Select the idle.bat file.
  11. Click Open.
  12. Click OK to close out of Properties.
  13. Now you can open .py files in IDLE simply by double-clicking on them.

Written by Nat Dunn. Follow Nat on Twitter.


Related Articles

  1. Understanding Python’s __main__ variable
  2. How to find all your Python installations on Windows (and Mac)
  3. Associate Python Files with IDLE (this article)
  4. Python Virtual Environments with venv
  5. Mapping python to Python 3 on Your Mac