2👍
✅
Neither python nor argparse
do any wildcard expansion on the argv
list passed in from the parent process. Instead, this is handled by the shell.
It’ll depend on the shell wether or not your style of expansion is even supported. Evidently, the shell that shell_exec()
spawns (usually /bin/sh
) does not support bash-style brace expansion. Instead, the wildcards are passed through to Python un-expanded.
Simplify the wildcard style by relying on *
expansion only:
echo shell_exec('./demos/compare.py images/examples/lennon* images/examples/clapton*')
Source:stackexchange.com