diff --git a/src/appenv.py b/src/appenv.py index aeab46f..d33dc3d 100755 --- a/src/appenv.py +++ b/src/appenv.py @@ -175,7 +175,9 @@ def ensure_minimal_python(): sys.exit(66) -def ensure_best_python(): +def ensure_best_python(base): + os.chdir(base) + if "APPENV_BEST_PYTHON" in os.environ: # Don't do this twice to avoid being surprised with # accidental infinite loops. @@ -473,7 +475,9 @@ def update_lockfile(self, args=None, remaining=None): def main(): - ensure_best_python() + base = os.path.dirname(__file__) + + ensure_best_python(base) # clear PYTHONPATH variable to get a defined environment # XXX this is a bit of history. not sure whether its still needed. keeping # it for good measure @@ -482,7 +486,6 @@ def main(): # Determine whether we're being called as appenv or as an application name application_name = os.path.splitext(os.path.basename(__file__))[0] - base = os.path.dirname(__file__) appenv = AppEnv(base) try: