1

I'm using ubuntu 14.04 LTS and I have installed both python 2.7 and python 3.4 . I have tried everything here How do I set IDLE as the default editor for Python scripts? but its not working. Can some please help me I want to make the IDLE the default program to open my python scripts and if possible to set it for both python2 and python3. Thank you

2
  • Check this link unix.stackexchange.com/questions/168939/…
    – vembutech
    Jan 5, 2015 at 10:12
  • @vembutech I tried everything on that link even when I try this line on the terminal xdg-mime query default text/x-python I get output idle2.desktop so it should work but i still don't find the IDLE on the open with -> other application window
    – William
    Jan 5, 2015 at 15:19

2 Answers 2

2

After a few days of trial and error I found the answer to my question. I decided to post my solution to my question because it might help someone who is experiencing the same problem. Here are the steps that I followed.

  1. Open the terminal crt+alt+t
  2. Type gedit ~/.local/share/applications/mimeapps.list
  3. Under [Added Associations] list add text/x-python=idle-python2.7.desktop;
  4. The text/x-python=idle-python2.7.desktop; entry must be the first line of the [Added Associations] list
  5. Under the [Default Applications] add text/x-python=idle-python2.7.desktopthis must also be the first line.
  6. Note the [Default Applications] entry does not have a ; at the end
  7. If you have python3 substitute idle-python2.7.desktop by idle-python3.4.desktop

What I'm yet to figure out is how to open a python3 script with the IDLE3 and a python2 script with IDLE2 in computers that have both python versions installed like mine. Currently with my solution both python3 and python2 scripts will open with the same IDLE. For example I have a scrip1.py which I programmed with python3 and script2.py which I programmed with python2 both of this scripts will open with the IDLE that a write on the mimeapps list. If i write text/x-python=idle-python2.7.desktop; they both open with IDLE2 and if i write text/x-python=idle-python2.7.desktop; and also text/x-python=idle-python3.4.desktop; IDLE3 will take preferrence and both script1.py and script2.py will open with IDLE3. I Hope thats clear and if anyone can help me to solve this problem it would be much appreciated.Thank You

0

In Ubuntu 20.04: Right-click on any Python file, click on 'Properties', set "Open with:' to IDLE.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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