Question: Why is this code not executing the program? The file path is correct. I'm using fork() to create child processes and execv() to get those
Why is this code not executing the program? The file path is correct. I'm using fork() to create child processes and execv() to get those child processes to run unix commands successfully in the same program.
import os filepath = '/Users/my_name/Desktop/school/Spring23/OS/os_code/file_name.py'
pid = os.fork() if pid == 0: os.execv('/usr/local/bin/python3', ['python3', filepath, '100000']) When I enter python3 '/Users/my_name/Desktop/school/Spring23/OS/os_code/file_name.py' 100000 into my shell I get the correct output.
Step by Step Solution
There are 3 Steps involved in it
Get step-by-step solutions from verified subject matter experts
