Change:
When converting a jupyter notebooks to a python code file, images no longer load. VS Code version: 1.60.0 Jupyter Extension version (available under the Extensions sidebar): v2021.8. Python Extension version (available under the Extensions sidebar): v2021.9. OS (Windows Linux distro) and version: Linux 5.8.0-59-generic 20.04.1-Ubuntu Python and/or Anaconda version: 3.9.6 Type of virtual environment used (N/A ...): conda Jupyter server running: Local a python file with the following code a random local image the cell The image should load After opening the dev tools, it seems that vscode is trying to load https://vscode- instead of the local file, using an online image from the web does work, unfortunetly local files does not even when using the protocol.
I can replicate this, for some reason images are not loaded when in interactive window.
hi, could you get any updates?
<!-- AUTHORVERIFICATIONREQUEST --This bug has been fixed in the latest release of ! you can help us out by commenting if things are now working as expected. If things still don't seem right, please ensure you're on version of Insiders (today's or later - you can use in the command palette to check), and leave a comment letting us know what isn't working as expected. Happy Coding!
Still not working, the local images are not loading. Version: 1.71.0-insider Commit: Date: 2022-08-24T05:18:31.474Z Electron: 19.0.12 Chromium: 102.0.5005.167 16.14.2 V8: 10.2.154.15-electron.0 OS: Linux x64 5.19.3--generic Sandboxed: Yes
Works fine for me: ! Do you have a folder open with both the notebook and image in it?
Thanks for the clarification, yes it only works when the folder is opened. For comparison, if I create a .ipynb file, the images are loaded even though no folder is opened.
Reopening based on the submitter's comment
I believe this is working as intended. The OP confirmed it works when a folder is open. If you don't have a folder open though, we don't know where the load images from You could argue that in the no folder case we should then use the file's directory, but the interactive window is not linked to a single python file so I'm wary of trying to make this too clever. Better to keep it consistent IMO

Discussion:
} async createWebview(): Promise<void> { <del> const baseUrl = this.asWebviewUri(dirname(this.documentUri), undefined); </del> <ins> const baseUrl = this.asWebviewUri(this.getNotebookBaseUri(), undefined); </ins> // Python notebooks assume that requirejs is a global. // For all other notebooks, they need to provide their own loader.

await this._initialized; } <ins> private getNotebookBaseUri() { if (this.documentUri.scheme === Schemas.untitled || this.documentUri.scheme === Schemas.vscodeInteractive) { const folder = this.workspaceContextService.getWorkspaceFolder(this.documentUri); if (folder) { return folder.uri; } const folders = this.workspaceContextService.getWorkspace().folders; if (folders.length) { return folders[0].uri; } } return dirname(this.documentUri); } </ins> private getBuiltinLocalResourceRoots(): URI[] { // Python notebooks assume that requirejs is a global. // For all other notebooks, they need to provide their own loader.

private _createInset(webviewService: IWebviewService, content: string) { const workspaceFolders = this.contextService.getWorkspace().folders.map(x => x.uri); <del> const notebookDir = dirname(this.documentUri); </del> <ins> const notebookDir = this.getNotebookBaseUri(); </ins> this.localResourceRootsCache = [ ...this.notebookService.getNotebookProviderResourceRoots(),