$HOME/.local/share/applications/mimeapps.list if you want such association to be only applied for your user.
Add the following lines:
Note, if you want the
.py association for all users the file to modify is (using
To set up IDLE as the default editor you'll have to make the idle.desktop file visible in the "Open with" list. To to so edit this file using sudo:
sudo gedit /usr/share/applications/idle.desktop
And replace its content by the following lines:
Comment=Integrated Development Environment for Python
Needless to restart your session or computer, to set the default application for the python type, locate a file of that type (*.py) in the file manager, right-click it, and select Properties.
Click the "Open With" tab and select the application you want to use for that file type.
Use the Set as default button to make the application the default application.
From now, clicking on a python file should open your preferred editor.