Ensure that PYTHONHOME is set for sub-processes such as the background executor.

This commit is contained in:
Ashesh Vashi 2017-02-10 22:42:44 +00:00 committed by Dave Page
parent 24a3f3ab42
commit 2f6a0e01da

View File

@ -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(