Take the 2-minute tour ×
Ask Ubuntu is a question and answer site for Ubuntu users and developers. It's 100% free, no registration required.

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

share|improve this question
    
Thanks Danatela for making the screenshots visible. I don't have a high enough reputation to embed images yet. –  crclayton Mar 22 at 7:21

3 Answers 3

up vote 4 down vote accepted

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.

share|improve this answer
    
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. –  crclayton Mar 29 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. –  Rocky DeHart Mar 30 at 0:47

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.

share|improve this answer
    
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. –  crclayton Mar 22 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. –  Sylvain Pineau Mar 22 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. –  crclayton Mar 22 at 17:16

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!

share|improve this answer

Your Answer

 
discard

By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.