The code is like this:
os.execlp('python', 'python', 'child.py', #other args#) # this works
os.execlp('python', 'child.py', #other args#) # this doesn't work
I read this question: execlp() in python
But I'm still confused. The answer said:
The first argument is the program to execute (found on the PATH). The rest are the sys.argv arguments to the program.
However, if I run: python child.py 1 2 3
and the sys.argv
of this process would be ["child.py", "1", "2", "3"]
, where the python
doesn't exist. Then why should I add python
as the second parameter of os.execlp
?