Can this be somehow overcome? Can a child process create a subprocess?
The problem is, I have a ready application which needs to call a Python script. This script on its own works perfectly, but it needs to call existing shell scripts.
Schematically the problem is in the following code:
parent.py
import subprocess
subprocess.call(['/usr/sfw/bin/python', '/usr/apps/openet/bmsystest/relAuto/variousSW/child.py','1', '2'])
child.py
import sys
import subprocess
print sys.argv[0]
print sys.argv[1]
subprocess.call(['ls -l'], shell=True)
exit
Running child.py
python child.py 1 2
all is ok
Running parent.py
python parent.py
Traceback (most recent call last):
File "/usr/apps/openet/bmsystest/relAuto/variousSW/child.py", line 2, in ?
import subprocess
ImportError: No module named subprocess
import subprocessline in child.py, try printingsys.path. Compare between the case where it works and the case where it doesn't.