microsoft / vscode-python

Python extension for Visual Studio Code
https://aka.ms/pvsc-marketplace
MIT License
4.29k stars 1.17k forks source link

Extension activation failed when the notebook was opened and switched to restricted mode. #24023

Open ttSpace opened 2 weeks ago

ttSpace commented 2 weeks ago

Environment data

Code Snippet

x = "str

Repro Steps

  1. Create a new directory somewhere on disk.
  2. Open VS Code.
  3. Open that new directory via File > Open Folder...
  4. Create a new Jupyter notebook.
  5. Add the following to one of the cells. You should see an error squiggle under "str because the trailing quotes are missing:
    x = "str
  6. Save the notebook in the directory.
  7. Run "Workspaces: Manage Workspace Trust" via the command palette.
  8. Press the "Don't Trust" button.

Expected behavior

Pylance should restart but not crash.

Actual behavior

Extension activation failed when the notebook was opened and switched to restricted mode.

image

image

Logs

Output for Python Language Server in the Output panel

``` 2024-08-29 09:42:33.180 [info] (Client) Pylance async client (2024.8.104) started with python extension (2024.13.2024082701) 2024-08-29 09:42:33.698 [info] [Info - 9:42:33 AM] (12876) Server root directory: file:///c%3A/Users/vting/.vscode-insiders/extensions/ms-python.vscode-pylance-2024.8.104/dist 2024-08-29 09:42:33.698 [info] [Info - 9:42:33 AM] (12876) Pylance language server 2024.8.104 (pyright version 1.1.378, commit ce64adc1) starting 2024-08-29 09:42:33.698 [info] [Info - 9:42:33 AM] (12876) Starting service instance "Folder5" 2024-08-29 09:42:33.738 [info] [Info - 9:42:33 AM] (12876) Setting environmentName for service "Folder5": "3.10.11 (global)" 2024-08-29 09:42:33.739 [info] [Info - 9:42:33 AM] (12876) Setting pythonPath for service "Folder5": "C:\Python310\python.exe" 2024-08-29 09:42:33.739 [info] [Info - 9:42:33 AM] (12876) No include entries specified; assuming c:\Users\vting\Downloads\Folder5 2024-08-29 09:42:33.740 [info] [Info - 9:42:33 AM] (12876) Auto-excluding **/node_modules 2024-08-29 09:42:33.740 [info] [Info - 9:42:33 AM] (12876) Auto-excluding **/__pycache__ 2024-08-29 09:42:33.740 [info] [Info - 9:42:33 AM] (12876) Auto-excluding **/.* 2024-08-29 09:42:33.898 [info] [Info - 9:42:33 AM] (12876) Assuming Python version 3.10.11.final.0 2024-08-29 09:42:34.144 [info] [Info - 9:42:34 AM] (12876) No source files found. 2024-08-29 09:42:34.377 [info] [Info - 9:42:34 AM] (12876) Background analysis(1) root directory: file:///c%3A/Users/vting/.vscode-insiders/extensions/ms-python.vscode-pylance-2024.8.104/dist 2024-08-29 09:42:34.377 [info] [Info - 9:42:34 AM] (12876) Background analysis(1) started 2024-08-29 09:42:34.730 [info] [Info - 9:42:34 AM] (12876) Indexer background runner(2) root directory: file:///c%3A/Users/vting/.vscode-insiders/extensions/ms-python.vscode-pylance-2024.8.104/dist (index) 2024-08-29 09:42:34.730 [info] [Info - 9:42:34 AM] (12876) Indexing(2) started 2024-08-29 09:42:35.473 [info] [Info - 9:42:35 AM] (12876) scanned(2) 20 files over 1 exec env 2024-08-29 09:42:36.024 [info] [Info - 9:42:36 AM] (12876) indexed(2) 9 files over 1 exec env 2024-08-29 09:42:36.042 [info] [Info - 9:42:36 AM] (12876) Indexing finished(2). 2024-08-29 09:43:00.417 [info] (Client) Pylance async client (2024.8.104) started with python extension (2024.13.2024082701) 2024-08-29 09:43:00.990 [info] [Info - 9:43:00 AM] (16812) Server root directory: file:///c%3A/Users/vting/.vscode-insiders/extensions/ms-python.vscode-pylance-2024.8.104/dist 2024-08-29 09:43:00.990 [info] [Info - 9:43:00 AM] (16812) Pylance language server 2024.8.104 (pyright version 1.1.378, commit ce64adc1) starting 2024-08-29 09:43:00.990 [info] [Info - 9:43:00 AM] (16812) Starting service instance "Folder4" 2024-08-29 09:43:01.030 [info] [Info - 9:43:01 AM] (16812) Setting environmentName for service "Folder4": "3.10.11 (global)" 2024-08-29 09:43:01.030 [info] [Info - 9:43:01 AM] (16812) Setting pythonPath for service "Folder4": "C:\Python310\python.exe" 2024-08-29 09:43:01.031 [info] [Info - 9:43:01 AM] (16812) No include entries specified; assuming c:\Users\vting\Downloads\Folder4 2024-08-29 09:43:01.032 [info] [Info - 9:43:01 AM] (16812) Auto-excluding **/node_modules 2024-08-29 09:43:01.032 [info] [Info - 9:43:01 AM] (16812) Auto-excluding **/__pycache__ 2024-08-29 09:43:01.032 [info] [Info - 9:43:01 AM] (16812) Auto-excluding **/.* 2024-08-29 09:43:01.183 [info] [Info - 9:43:01 AM] (16812) Assuming Python version 3.10.11.final.0 2024-08-29 09:43:01.398 [info] [Info - 9:43:01 AM] (16812) No source files found. 2024-08-29 09:43:01.624 [info] [Info - 9:43:01 AM] (16812) Background analysis(1) root directory: file:///c%3A/Users/vting/.vscode-insiders/extensions/ms-python.vscode-pylance-2024.8.104/dist 2024-08-29 09:43:01.624 [info] [Info - 9:43:01 AM] (16812) Background analysis(1) started 2024-08-29 09:43:01.999 [info] [Info - 9:43:01 AM] (16812) Indexer background runner(2) root directory: file:///c%3A/Users/vting/.vscode-insiders/extensions/ms-python.vscode-pylance-2024.8.104/dist (index) 2024-08-29 09:43:01.999 [info] [Info - 9:43:01 AM] (16812) Indexing(2) started 2024-08-29 09:43:02.730 [info] [Info - 9:43:02 AM] (16812) scanned(2) 20 files over 1 exec env 2024-08-29 09:43:02.883 [info] [Info - 9:43:02 AM] (16812) indexed(2) 9 files over 1 exec env 2024-08-29 09:43:02.902 [info] [Info - 9:43:02 AM] (16812) Indexing finished(2). 2024-08-29 09:43:15.135 [info] [Error - 9:43:15 AM] (16812) Error reading settings: TypeError: Cannot set properties of undefined (setting 'strictListInference') ```

rchiodo commented 2 weeks ago

Pylance is failing because the Python extension failed to load. It's a dependency of Pylance. Transferring to the Python extension.