catch getpythonuserdir error (#14193) (#14263)

This commit is contained in:
Lucy Zhang
2021-02-11 15:29:01 -08:00
committed by GitHub
parent b17ae9a24e
commit 4b87a0869f

View File

@@ -35,6 +35,7 @@ const msgWaitingForInstall = localize('msgWaitingForInstall', "Another Python in
function msgDependenciesInstallationFailed(errorMessage: string): string { return localize('msgDependenciesInstallationFailed', "Installing Notebook dependencies failed with error: {0}", errorMessage); }
function msgDownloadPython(platform: string, pythonDownloadUrl: string): string { return localize('msgDownloadPython', "Downloading local python for platform: {0} to {1}", platform, pythonDownloadUrl); }
function msgPackageRetrievalFailed(errorMessage: string): string { return localize('msgPackageRetrievalFailed', "Encountered an error when trying to retrieve list of installed packages: {0}", errorMessage); }
function msgGetPythonUserDirFailed(errorMessage: string): string { return localize('msgGetPythonUserDirFailed', "Encountered an error when getting Python user path: {0}", errorMessage); }
export interface PythonInstallSettings {
installPath: string;
@@ -705,6 +706,7 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
}
private async getPythonUserDir(pythonExecutable: string): Promise<string> {
try {
let sitePath: string;
if (process.platform === constants.winPlatform) {
sitePath = 'USER_SITE';
@@ -724,6 +726,9 @@ export class JupyterServerInstallation implements IJupyterServerInstallation {
return packagesDir;
}
} catch (err) {
this.outputChannel.appendLine(msgGetPythonUserDirFailed(utils.getErrorMessage(err)));
}
return undefined;
}