[Geany] Changing python version used

Colomban Wendling lists.ban at xxxxx
Sun Feb 19 15:42:01 UTC 2012


Hi,

Le 19/02/2012 16:31, Thomas Hedden a écrit :
> I have the following configuration:
> 
> $ geany --version
> geany 0.21 (built on Dec 24 2011 with GTK 2.24.8, GLib 2.30.1)
> 
> $ python --version
> Python 2.7.2
> $ which python
> /usr/bin/python
> 
> $ python3 --version
> Python 3.2.1
> $ which python3
> /usr/bin/python3
> 
> In Geany, if I run the following script ...
> import sys
> v = sys.version[:3]
> print(v)
> ... the output is:
> 2.7
> ------------------
> (program exited with code: 0)
> Press return to continue
> 
> I want to use python3 rather than python2.
> 
> I did a quick search of the manual, perhaps
> not thorough enough, but I could not find
> any information about this.
> 
> I opened the file `filetype_extension.conf'
> and found the line:
> Python=*.py;*.pyw;
> I added the line:
> Python3=*.py3;
> ... saved, and reloaded the configuration file,
> but there was no change.

This would make "*.py3" files open with filetype Python3, which doesn't
exist -- though you could imagine creating it, but that's not needed if
you simply want to run all Python with Python 3.

> It must be very easy to make Geany look at
> the python3 interpreter rather than the python2
> interpreter, but I can't figure out how. Can anyone
> please tell me how to do this?

Open a Python file, and go to Build->Set Build Commands.  Here, you
change the "Run" command to call python3 rather than simply python.  The
new value would look like:

python3 "%f"

Maybe you also want to update the "Build" command so you also compile
with python3.


Regards,
Colomban



More information about the Users mailing list