Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #69115

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

References <4b100198-73d0-4562-89cf-8af9b9b87174@googlegroups.com>
Date 2014-03-26 12:40 +0100
Subject Re: calling Python script from another Python script (Windows, multiple installation problem)
From Vlastimil Brom <vlastimil.brom@gmail.com>
Newsgroups comp.lang.python
Message-ID <mailman.8570.1395834055.18130.python-list@python.org> (permalink)

Show all headers | View raw


2014-03-26 10:40 GMT+01:00 Martin Landa <landa.martin@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

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

calling Python script from another Python script (Windows, multiple installation problem) Martin Landa <landa.martin@gmail.com> - 2014-03-26 02:40 -0700
  Re: calling Python script from another Python script (Windows, multiple installation problem) Vlastimil Brom <vlastimil.brom@gmail.com> - 2014-03-26 12:40 +0100
    Re: calling Python script from another Python script (Windows, multiple installation problem) Martin Landa <landa.martin@gmail.com> - 2014-03-26 05:29 -0700
      Re: calling Python script from another Python script (Windows, multiple installation problem) Martin Landa <landa.martin@gmail.com> - 2014-03-26 05:49 -0700
        Re: calling Python script from another Python script (Windows, multiple installation problem) Chris Angelico <rosuav@gmail.com> - 2014-03-26 23:54 +1100
          Re: calling Python script from another Python script (Windows, multiple installation problem) Martin Landa <landa.martin@gmail.com> - 2014-03-26 06:11 -0700
        Re: calling Python script from another Python script (Windows, multiple installation problem) Cameron Simpson <cs@zip.com.au> - 2014-03-27 08:27 +1100

csiph-web