From 2f6a0e01da9acfa0d24977bdd191cd04529d370e Mon Sep 17 00:00:00 2001 From: Ashesh Vashi Date: Fri, 10 Feb 2017 22:42:44 +0000 Subject: [PATCH] Ensure that PYTHONHOME is set for sub-processes such as the background executor. --- web/pgAdmin4.py | 11 +++++++++++ 1 file changed, 11 insertions(+) diff --git a/web/pgAdmin4.py b/web/pgAdmin4.py index 68848c001..d190cd163 100644 --- a/web/pgAdmin4.py +++ b/web/pgAdmin4.py @@ -75,6 +75,17 @@ if __name__ == '__main__': print("Starting %s. Please navigate to http://%s:%d in your browser." % (config.APP_NAME, config.DEFAULT_SERVER, server_port)) sys.stdout.flush() + else: + # For unknown reason the Qt runtime does not pass the environment + # variables (i.e. PYTHONHOME, and PYTHONPATH), to the Python + # sub-processes, leading to failures executing background processes. + # + # This has been observed only on windows. On *nix systems, it is likely + # picking the system python environment, which is good enough to run + # the process-executor. + # + # Setting PYTHONHOME launch them properly. + os.environ['PYTHONHOME'] = sys.prefix try: app.run(