[Python-porting] Shebang lines for Python 3

Aaron DeVore aaron.devore at gmail.com
Wed Sep 7 01:33:44 CEST 2011


On Tue, Sep 6, 2011 at 9:30 AM, Aaron Meurer <asmeurer at gmail.com> wrote:
> Ah, so the Arch argument really isn't a good one, because /usr/bin/env
> python3 will still work there.  And as far as I've heard, it will work
> everywhere else too.
>
> The real problem with Arch is that Python 2 stuff will break, not
> Python 3, and as we decided, this is Arch's fault, not ours.

Arch's justification was that switching /usr/bin/python would push
developers and library writers to port to Python 3. It mostly just
annoyed people, including me.

However, Arch brought up a valid point: Python developers should not
depend on "python" pointing to Python 2 for all eternity.
Distributions, users, or sysadmins may not want:

    $ python

to point to an obsolete version. Shebangs are fine if setup.py uses
the scripts parameter to get shebang rewriting. Shebangs that require
a run of 'sed' are less ideal, but workable. Using:

    subprocess.Popen(['python', 'script_name.py'])

is bad.

-Aaron DeVore


More information about the Python-porting mailing list