calling Python script from another Python script (Windows, multiple installation problem)
vlastimil.brom at gmail.com
Wed Mar 26 12:40:47 CET 2014
2014-03-26 10:40 GMT+01:00 Martin Landa <landa.martin at gmail.com>:
> Hi all,
> I am trying to fix a bug in the project which I am working for. The program starts on Windows via bat file which calls a Python script to set up the environment including GUI and allow to launch program-specific tools. Some of the tools are written in C, some in Python. These commands are run via subprocess.Popen class. The Windows installer comes with its own bundled Python which is usually different from possible system-wide Python. This is source of the problems, Python scripts run via subprocess.Popen are launched via system-wide Python version, not desired bundled Python. Except hacks like `Popen(sys.executable, ...)` I am looking for a better solution. I checked virtualenv  or Pylauncher  but without success, speaking about Python2 not Python3 which comes from version 3.3 with intergrated pylauncher...
> Thanks in advance for any ideas, suggestions or pointers! Martin
>  http://www.virtualenv.org/en/latest/
>  https://bitbucket.org/vinay.sajip/pylauncher
I'm probably missing some requirement of your use case, but I guess,
it should be possible to specify the path of the desired python
interpreter along with the executed script as an argument to
Popen(...). This should make the selection of the used python
Or are there any other disadvantages of the current approach, which
you are solving in parallel?
More information about the Python-list