Python: Start a new process replacing the current process
Write a Python program to start a new process replacing the current process.
Sample Solution:
Python Code :
main.py:
import os
import sys
program = "python"
arguments = ["hello.py"]
print(os.execvp(program, (program,) + tuple(arguments)))
print("Goodbye")
hello.py:
print("Operating System Services Exercises-18")
Sample Output:
Operating System Services Exercises-18
Python Code Editor:
Have another way to solve this solution? Contribute your code (and comments) through Disqus.
Previous: Write a Python program to run an operating system command using the os module.
Next: Python Operating System Services Home page.
What is the difficulty level of this exercise?
Test your Programming skills with w3resource's quiz.
- Weekly Trends and Language Statistics
- Weekly Trends and Language Statistics