osdir.com


[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

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


When you run a script via "python3 script.py" you can include command
line options like -b, -B, -O, -OO, etc between the "python3" interpreter
reference and the script.py file, eg. "python3 -b -B -O -OO script.py".
When you create a script that is executable directly, eg. script.py with
execution bit set on Linux or on Windows where the .py file extension is
associated with a specific Python executable, there doesn't appear to be
a way to pass command line options to the script. In this later case,
how can I pass my script command line options without having these
options confused with command line arguments?
Thank you,
Malcolm