From dfb40e01595f8228b101a219a7018e23976306fd Mon Sep 17 00:00:00 2001 From: Chris LaFreniere <40371649+chlafreniere@users.noreply.github.com> Date: Fri, 30 Oct 2020 11:06:46 -0700 Subject: [PATCH] Notebooks: Ensure Python Environment Variables are Removed Before First Python Command (#13097) * Add CodeQL Analysis workflow (#10195) * Add CodeQL Analysis workflow * Fix path * Ensure we delete python env vars correctly * Move delete to top of method Co-authored-by: Justin Hutchings --- .../notebook/src/jupyter/jupyterServerInstallation.ts | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts index 2d42e8acfc..d5e07784e3 100644 --- a/extensions/notebook/src/jupyter/jupyterServerInstallation.ts +++ b/extensions/notebook/src/jupyter/jupyterServerInstallation.ts @@ -288,6 +288,11 @@ export class JupyterServerInstallation implements IJupyterServerInstallation { } public async configurePackagePaths(): Promise { + // Delete existing Python variables in ADS to prevent conflict with other installs + delete process.env['PYTHONPATH']; + delete process.env['PYTHONSTARTUP']; + delete process.env['PYTHONHOME']; + //Python source path up to bundle version let pythonSourcePath = this._usingExistingPython ? this._pythonInstallationPath @@ -329,11 +334,6 @@ export class JupyterServerInstallation implements IJupyterServerInstallation { } } - // Delete existing Python variables in ADS to prevent conflict with other installs - delete process.env['PYTHONPATH']; - delete process.env['PYTHONSTARTUP']; - delete process.env['PYTHONHOME']; - // Store the executable options to run child processes with env var without interfering parent env var. let env = Object.assign({}, process.env); delete env['Path']; // Delete extra 'Path' variable for Windows, just in case.