Tuesday, May 14, 2024
 Popular · Latest · Hot · Upcoming
2
rated 0 times [  2] [ 0]  / answers: 1 / hits: 2365  / 1 Year ago, mon, december 19, 2022, 12:52:46

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


More From » python

 Answers
3

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


[#21803] Tuesday, December 20, 2022, 1 Year  [reply] [flag answer]
Only authorized users can answer the question. Please sign in first, or register a free account.
nguai

Total Points: 216
Total Questions: 108
Total Answers: 116

Location: Hong Kong
Member since Thu, Dec 16, 2021
2 Years ago
;