execute_process: how to pass argument to python script

execute_process(COMMAND ${Python3_EXECUTABLE} my_script.py my_arg)

doesn’t work as intended: my_script.py is executed, but does not see the argument my_arg.

Whereas on the command line

$ python3 my_script.py my_args

does work.

As a minimal example, suppose my_script.py is

import sys
print("my_script found argument", sys.argv[1])

This works locally:

% cmake -P run.cmake
-- Found Python3: /usr/bin/python3.9 (found version "3.9.10") found components: Interpreter 
my_script found argument my_arg
% cat my_script.py
import sys
print("my_script found argument", sys.argv[1])
% cat run.cmake
find_package(Python3 REQUIRED COMPONENTS Interpreter)
execute_process(COMMAND ${Python3_EXECUTABLE} my_script.py my_arg)

Can you provide a fuller example that shows the problem?

Thank you very much, Ben.

Things didn’t work in my more complex code because I confused upper and lower case in a variable name.

Apologies, Joachim