4

I have followed the instructions in this thread: How do I set IDLE as the default editor for Python scripts?, but it hasn't resulted in the option to open in IDLE being shown.

So I used the 'Find applications online' option in the 'Open with...' menu and installed SPE (Stanli's Python Editor) at it's recommendation, but the option to open .py files with that also isn't in the menu.

Does anyone have any suggestions? I'm running ubuntu 13.10 and am trying to use Python 3.3.

Thanks in advance.

Screenshots:

Option 1:

mimeapps.list

open with options

Option 2:

idle.desktop

more open with options

1
  • Thanks Danatela for making the screenshots visible. I don't have a high enough reputation to embed images yet. Mar 22, 2014 at 7:21

3 Answers 3

5

I had the same problem. This how I solved it:

  1. Uninstall idle from where you installed it.
  2. Install IDLE (using Python-3.3) from the Ubuntu Software Center. (It didn't work when I installed from Synaptic)
  3. Enter in terminal: gksudo gedit /usr/share/applications/idle-python3.3.desktop
  4. Edit file so it looks like this (exactly):
[Desktop Entry]
Name=IDLE (using Python-3.3)
Comment=Integrated Development Environment for Python (using Python-3.3)
Exec=/usr/bin/idle-python3.3 %F
Icon=/usr/share/pixmaps/python3.3.xpm
Terminal=false
Type=Application
Categories=Application;Development;
MimeType=text/x-python;
StartupNotify=true

Then it was visible in the menu for me.

2
  • That did it! I didn't even need to reinstall IDLE! Thank you so much. I'd +1 you if I had a high enough reputation. Mar 29, 2014 at 17:18
  • I happy to hear. I noticed that every other answer opened the file "idle.desktop". That file does not exist when using Python 3.3. So instead I changed the file "idle-python3.3.desktop" and it worked. Mar 30, 2014 at 0:47
1

OPTION 1:

Edit your $HOME/.local/share/applications/mimeapps.list if you want such association to be only applied for your user.

Add the following lines:

[Default Applications]
text/x-python=idle.desktop

[Added Associations]
text/x-python=idle.desktop;

Note, if you want the .py association for all users the file to modify is (using sudo):

/usr/share/applications/defaults.list

OPTION 2:

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:

[Desktop Entry]
Name=IDLE
Comment=Integrated Development Environment for Python
Exec=/usr/bin/idle %F
Icon=/usr/share/pixmaps/idle.xpm
Terminal=false
Type=Application
Categories=Application;Development;
MimeType=text/x-python;
StartupNotify=true

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.

enter image description here

From now, clicking on a python file should open your preferred editor.

3
  • Thanks for your reply! So, I did that, and from what I've read elsewhere, that's exactly what should do it, but for some reason not only is it not giving me the default, it's not giving me the option to open with it at all. I've edited my post to include screenshots. Mar 22, 2014 at 7:08
  • I tested option 2 on a clean 13.10 system to set up Geany as my default python editor, it works. Please try this way. Mar 22, 2014 at 14:17
  • Thanks once again for you help. I tried option 2 (see new screenshots) and it's still not giving me anything. Can you see what I'm doing wrong? I'm new to ubuntu and I'm starting to think it's just a lost cause. Mar 22, 2014 at 17:16
1

Thank you Sylvain Pineau for your contribution.

But I just want to add something to your answer for those who have installed python3 and use IDLE3. None of the two options there worked, but then I figured out that maybe it could work if I modify it, because I have python3.

Here we go, for python3:

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/idle3.desktop

And replace its content by the following lines:

[Desktop Entry]
Name=IDLE 3
Comment=Integrated DeveLopment Environment for Python3
Exec=/usr/bin/idle3 %F
Icon=/usr/share/pixmaps/idle3.xpm
Terminal=false
Type=Application
Categories=Application;Development;
MimeType=text/x-python3;
StartupNotify=true

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.

Thank you so much!

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .