I have a set of scripts that should modify os.sys.path "on the fly." Then the scripts start the subprocess. Ideally, the subprocess will have the same os.sys.path as the caller. I want to avoid passing it as an argument, as this will require a modification of the script subprocess.
I have code that works and meets all my needs. I want to know if there is a better way to do this, and if there are any pitfalls for this approach.
Main process
import os import sys import subprocess
C: /pytest/test_subprocess.py
import sys print 'sys path' print sys.path
Starting the main process leads to the conclusion of this console

As you can see, C: / pytest2 / is located on os.sys.path for test_subprocess.py
EDIT Changed os.sys for sys
source share