calling Python script from another Python script (Windows, multiple installation problem)

Vlastimil Brom vlastimil.brom at gmail.com
Wed Mar 26 07:40:47 EDT 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 [1] or Pylauncher [2] 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
>
> [1] http://www.virtualenv.org/en/latest/
> [2] https://bitbucket.org/vinay.sajip/pylauncher
> --
> https://mail.python.org/mailman/listinfo/python-list


Hi,
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
explicit.
Or are there any other disadvantages of the current approach, which
you are solving in parallel?

hth,
  vbr



More information about the Python-list mailing list