'Lock current working directory in subprocess? or make cwd as home directory
simply I am using windows 10 operating system and run code in python as
main.py
cmd = "python example.py"
sp = subprocess.Popen(cmd, shell=True, stdin=subprocess.PIPE, stdout=subprocess.PIPE, stderr=subprocess.PIPE, universal_newlines=True, cwd="/home", env=new_env)
so cwd is now C:/home but using os.chdir() I am able to change directory to D: or like C:/User/Desktop etc, externally using example.py.
Now, I would like to lock the directory to /home so, if any code run through example.py then the main directory for the code run in example.py will be /home and the directory is not be able to change from /home any other directory.
Sources
This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.
Source: Stack Overflow
| Solution | Source |
|---|
