Skip to content

python

miscellaneous · scripts/miscellaneous/python.m

: result = python (scriptfile)
: result = python (scriptfile, arg1, …, argn)
: [result, status] = python (…)

Run the Python script scriptfile with the given arguments, using the Python 3 interpreter of the system.

Each argument is a string and reaches the script as one separate element of sys.argv, exactly as written; the shell does not expand or split it. Empty arguments are left out.

result is the text that the script wrote to standard output and status is the exit status of the interpreter. A missing script file gives a message in result and a nonzero status.