The first argument you pass to os.execl
(after the script
argument) is the "name" of the program being run (it can be anything, doesn't have to be the actual path to the executable file). That's what script.py
would see as its sys.argv[0]
(see the docs, and also this question, for example, explaining how argv[0]
works).
From the docs:
argv[0] is the script name (it is operating system dependent whether this is a full pathname or not)
To get the behavior you expect, call it like:
os.execl(args.script, args.script, *args.script_argument)