uses both shell and python codes in one script.

Chris Angelico rosuav at gmail.com
Thu Oct 3 19:17:10 EDT 2019


On Fri, Oct 4, 2019 at 9:13 AM Cameron Simpson <cs at cskk.id.au> wrote:
>
> On 04Oct2019 03:34, Chris Angelico <rosuav at gmail.com> wrote:
> >On Fri, Oct 4, 2019 at 12:15 AM James Lu <jamtlu at gmail.com> wrote:
> >> I would use IPython as a scripting language. It has a slow startup
> >> time though.
> >>
> >And how, in the messy world of cross-platform scripting, would you
> >locate the interpreter? The whole point of this script is to attempt
> >three different shebangs, effectively.
>
> Well, yes, but personally I'd prefer to just run with "#!/usr/bin/env
> python3". Then the command line will say "python3: not found" or
> similar, I can fix my environment, and thereafter everything works
> better. Rather than complex magic inside a script.
>
> If we're going to accept the approach though, I'd rather the shebang was
> just "#!/bin/sh". There's _always_ a /bin/sh, and a number of BSDish
> systems do not have a /usr/bin/env (it tends to land in /bin instead).

My point was that ipython solves nothing. The whole point of merging
shell and Python was to prepare the environment for the REAL app,
which is pure Python; so using ipython would add a costly dependency
without actually helping in any way. Just run it in Python and that's
that.

ChrisA



More information about the Python-list mailing list