microsoft / vscode-jupyter

VS Code Jupyter extension
https://marketplace.visualstudio.com/items?itemName=ms-toolsai.jupyter
MIT License
1.28k stars 286 forks source link

Backslash replaces slash in paths to code files when debugging a cell interactively #9636

Open avm19 opened 2 years ago

avm19 commented 2 years ago

Applies To

What happened?

Possibly related to #9635

The contents of test.py:

# %%
import numpy

print(numpy.__version__)

My setup:

Apparently, pressing F5 ("Debug: Start Debugging") and clicking on the "Debug Python File" button in the top-right corner start debugging in different "purposes". I will refer to both these cases as the standard debugging, as opposed to interactive debugging, which happens when one clicks on "Debug Cell" above a # %%-cell. I am not sure about this terminology, but I hope it makes sense.

  1. I start debugging (either standard or interactive).
  2. I step into the import statement.
  3. I hover over the tab tip so that a hint tooltip appears with the full file path.

In the standard debugging I see: standard debugging

In the interative debugging I see: interative debugging

Expected behaviour: regular forward slashes in both cases. Observed behaviour: backslashes in the interactive debugging. Additionally, breakpoints are registered with backslashes in the BREAKPOINTS list (Run and Debug side panel). As a result, I can't jump to the location of the breakpoint by double-clicking on its entry in the list.

As I said, I run VS Code under Windows and connect via SSH to a remote, which runs Ubuntu. It looks like the interactive part of Jupyter Notebooks or IPython can't sort it out between Windows and Unix path conventions. An interesting details is that the interactive debugging needs a kernel restart to work properly (see #9635 )[this was my misunderstanding], and each iteration opens a new tab in the editor: maybe the editor can't recognise that the file is already open (because of backslashes), or maybe this is a result of restarting the interactive kernel.

VS Code Version

Version: 1.67.0-insider (system setup) Commit: a3d53f76790d8c88f835afe85225ff6442703409 Date: 2022-04-07T05:15:43.863Z Electron: 17.3.1 Chromium: 98.0.4758.141 Node.js: 16.13.0 V8: 9.8.177.13-electron.0 OS: Windows_NT x64 10.0.19042

Jupyter Extension Version

v1.0.6

Jupyter logs

No response

Coding Language and Runtime Version

Python 3.7.7

Language Extension Version (if applicable)

v2022.5.10971003

Anaconda Version (if applicable)

conda 4.11.0

Running Jupyter locally or remotely?

N/A or Not sure

amunger commented 2 years ago

thanks for the bug, I can repro.

mankiddyman commented 1 year ago

has anyone managed to fix this since?

Sergey-Grudskiy commented 1 year ago

Still observing this issue in vscode 1.82

amunger commented 11 months ago

I'm no longer seeing this for a container, nor an ubuntu VM. Perhaps a library update fixed it? Can you try with the latest ipykernel/IPython/debugpy and see if still repros for you ?

ipykernel 6.25.2 IPython 8.12.3 debugpy 1.8.0