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
-
Check this link unix.stackexchange.com/questions/168939/…– BDRSuiteJan 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– WilliamJan 5, 2015 at 15:19
2 Answers
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.
- Open the terminal crt+alt+t
- Type
gedit ~/.local/share/applications/mimeapps.list
- Under [Added Associations] list add
text/x-python=idle-python2.7.desktop;
- The
text/x-python=idle-python2.7.desktop;
entry must be the first line of the [Added Associations] list - Under the [Default Applications] add
text/x-python=idle-python2.7.desktop
this must also be the first line. - Note the [Default Applications] entry does not have a ; at the end
- 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
In Ubuntu 20.04: Right-click on any Python file, click on 'Properties', set "Open with:' to IDLE.