This is an automated email from the ASF dual-hosted git repository. gstein pushed a commit to branch trunk in repository https://gitbox.apache.org/repos/asf/steve.git
commit 1e584ac373513dda1518eab50c76b41f78ba60b6 Author: Greg Stein <[email protected]> AuthorDate: Fri Mar 6 06:46:35 2026 -0600 tweak to use pathlib rather than argv[0] --- whatif.py | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/whatif.py b/whatif.py index 0e180b9..25a9eb8 100755 --- a/whatif.py +++ b/whatif.py @@ -35,7 +35,8 @@ import os.path import re import pathlib -THIS_DIR = pathlib.Path(__file__).resolve().parent +THIS_SCRIPT = pathlib.Path(__file__).resolve() +THIS_DIR = THIS_SCRIPT.parent # We're a top-level script. Adjust the import path. sys.path.append(str(THIS_DIR / 'monitoring')) @@ -43,11 +44,12 @@ import stv_tool def usage(): - print(f'Usage: {SCRIPTNAME} [-v] RAW_VOTES_FILE [seats] [-]name...') + print(f'Usage: {THIS_SCRIPT.name} [-v] RAW_VOTES_FILE [seats] [-]name...') sys.exit(1) -SCRIPTNAME = sys.argv.pop(0) +# Get rid of the script name. +_ = sys.argv.pop(0) if sys.argv and sys.argv[0] == '-v': stv_tool.VERBOSE = True
