Re: [code] [textadept] Run both Python 2 and 3

From: Robert Gieseke <>
Date: Sat, 18 Jul 2015 11:29:13 +0200

Hi Jay,

there are different approaches to this.
One way to explicitly switch the version used by Textadept would be to
use something like

keys.m3 = function() = 'python3 -u "%f"'
  ui.statusbar_text = "Python 3"

keys.m2 = function() = 'python2 -u "%f"'
  ui.statusbar_text = "Python 2"

Press Command-2 for Python 2, Command-3 to switch to Python 3.

That way you could test your scripts with both versions if that were

Another way would of course be to have Textadept look at the first line
in your script, to check if it's
#!/usr/bin/env python3
or similar.

Note that you need to set your PATH with different Python versions again
for Textadept if you don't want to set the full path.
From the manual:
"Mac OSX Environment Variables

By default, Mac OSX GUI apps like Textadept do not see shell environment
variables like “$PATH”. Consequently, any modules that utilize programs
contained in “$PATH” (e.g. the progams in /usr/local/bin/) for run and
compile commands will not find those programs. The solution is to create
a ~/.textadept/ file that exports all of the environment
variables you need Textadept to see."


Am 18/07/15 um 07:34 schrieb Jay Young:
> I've found that if I edit line 202 of the "run.lua" file to this:
> python='/Library/Frameworks/Python.framework/Versions/3.4/bin/python3.4
> -u "%f"' that I can run Python3 from Textadept. However, I'd like to
> be able to run either Python 2 or 3. My thought (even though it's
> rarely done) is to make python 3 file extensions ".py3" and then keep
> python 2 extensions as normal (".py"). Is there a way that Textadept
> could tell the difference then and run the file in the correct
> version of Python? Thanks. Jay

You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Sat 18 Jul 2015 - 05:29:13 EDT

This archive was generated by hypermail 2.2.0 : Sat 18 Jul 2015 - 06:28:00 EDT