I have a Pylons controller (irrelevant but explains why I have this need) say starter.py
that starts another process using:
retcode = subprocess.call(('python','/path/to/myScript.py'))
now since the app runs in a virtual env python
is not the right binary to call since it has no access to site-packages installed in my virtual env.
It should be instead:
retcode = subprocess.call(('path/to/virtual/env/bin/python','/path/to/myScript.py'))
and path/to/virtual/env/bin/python
is the same that is running starter.py
.
Any chance to not set this path (say, in a .ini file) and retrieve it?
The path is available in sys.executable
.