I have this problem:
System A
runs Ubuntu and needs Python 2.6
for a bunch of different things.
I Installed Python 2.7
separately on System A
System B
has Python 2.7
natively.
I have a python script BLAH
which says #!/bin/env python
up top.
Further down it executes another script SIGH
, which up top also says: #!/bin/env python
.
BLAH
needs to run on either System A
or System B
, and it always needs to run Python 2.7
----
Part of my solution so far:
Have a wrapper script that first tries to see if which python
is pointing to Python 2.7
If that's okay then run BLAH
with that path for python.
Else try which python2.7
and use that path to run BLAH
, and add that path to env PATH
.
Problem with this solution is:
On System A
(which has Python 2.7 installed separately)
When BLAH
executes, it runs with Python 2.7 because of the wrapper script I wrote (okay so far..)
When BLAH
spawns SIGH
, SIGH
uses the shebang to find python in the path and then it's in trouble because it's looking for python in env
's PATH
and it should be looking for python2.7
in the path.
Is there a clean way of handling this problem?
Thanks in advance!