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

From: Mitchell <m.att.foicica.com>
Date: Sat, 18 Jul 2015 09:40:16 -0400 (EDT)

Hi Jay,

On Sat, 18 Jul 2015, Jay Young wrote:

> 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?

You can put something like this in your ~/.textadept/init.lua file:

   textadept.run.run_commands.python = function()
     -- [code to determine which python to use]
     if python3 then
       return '/path/to/python3'
     else
       return '/path/to/python2'
     end
   end

Run commands may be functions, which are evaluated, and the returned
string is used as the actual shell command.

Cheers,
Mitchell

-- 
You are subscribed to code.att.foicica.com.
To change subscription settings, send an e-mail to code+help.att.foicica.com.
To unsubscribe, send an e-mail to code+unsubscribe.att.foicica.com.
Received on Sat 18 Jul 2015 - 09:40:16 EDT

This archive was generated by hypermail 2.2.0 : Sun 19 Jul 2015 - 06:41:15 EDT