How to pass Python command line options (vs arguments) when running script directly vs via Python interpreter?

eryk sun eryksun at gmail.com
Wed Aug 15 15:54:04 EDT 2018


On Wed, Aug 15, 2018 at 9:22 AM, Thomas Jollans <tjol at tjol.eu> wrote:
>
> If you really want to, you can pass a *single* argument in your #! line,
> e.g.:
>
> #!/usr/bin/python3 -Wd

This works for options that can be grouped into a single argument.
Multiple -X options aren't supported, nor is combining a -X option
with other options.

Using a shebang also works in Windows if .py files are associated with
the py.exe launcher, which can handle multiple arguments in the
shebang instead of just one.



More information about the Python-list mailing list