Re: [code] Textadept in the migration from Python2 to Python3

From: Arnel <>
Date: Fri, 22 Apr 2016 00:19:30 +0800

On 21 April 2016 03:59PM, Pedro Andres Aranda Gutierrez wrote:
> Hi folks,
> I'm starting to migrate from Python2 to Python3. No problems in Python2,
> but since the default program bindings are for Python2, I get tons of false
> warnings and errors.
> I'm currently marking migrated Python3 scripts with the following shebang:
> #!/usr/bin/env python3
> Is there any way to take this into account. At least to avoid false
> positives when saving files...
> Best, /PA

To identify Python3 scripts, you could add these to your 'init.lua':

   textadept.file_types.patterns['^#!.+[/ ]python3'] = 'python3' = function()
      return ([[python3 -c
      (buffer.filename:gsub('\\', '\\\\\\\\'))) end = 'python3 -u "%f"'

(You may need to adjust the indentation.)

That covers the syntax-checking and "run" commands for Python 3, at least.

However, if we change the default file extensions like so: = 'python3'

TA would read that as "all files ending in '.py' are Python3." Your Python2
scripts won't get identified as Python2 scripts.

Thank you,
You are subscribed to
To change subscription settings, send an e-mail to
To unsubscribe, send an e-mail to
Received on Thu 21 Apr 2016 - 12:19:30 EDT

This archive was generated by hypermail 2.2.0 : Fri 22 Apr 2016 - 06:52:13 EDT