How to manage python shebang on mixed systems?

Weatherby,Gerard gweatherby at uchc.edu
Mon Nov 7 06:56:19 EST 2022


Write the wrapper script.

#!/bin/bash
if [ $(hostname) == "oldystem" ]; then
    exec /usr/bin/python $*
else
    exec /usr/bin/python2 $*
fi

From: Python-list <python-list-bounces+gweatherby=uchc.edu at python.org> on behalf of Chris Green <cl at isbd.net>
Date: Sunday, November 6, 2022 at 3:22 PM
To: python-list at python.org <python-list at python.org>
Subject: Re: How to manage python shebang on mixed systems?
*** Attention: This is an external email. Use caution responding, opening attachments or clicking on links. ***

rbowman <bowman at montana.com> wrote:
> On Sun, 6 Nov 2022 10:03:50 +0000, Chris Green wrote:
>
>
> > Is there a neat way of handling this?  I could write a sort of wrapper
> > script to run via the shebang but that seems overkill to me.
>
> Can you symlink?

Not really, since the system where there's no python3 is one where I
only have user access.

--
Chris Green
·
--
https://urldefense.com/v3/__https://mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gN4FcCAwYqK8bafmF2dr_EB9nahZcdNmU91bHuymdlakU27cNTnIwQ_FckF9PBZlllGnW_vlEjQ$<https://urldefense.com/v3/__https:/mail.python.org/mailman/listinfo/python-list__;!!Cn_UX_p3!gN4FcCAwYqK8bafmF2dr_EB9nahZcdNmU91bHuymdlakU27cNTnIwQ_FckF9PBZlllGnW_vlEjQ$>


More information about the Python-list mailing list