Open ease-zh opened 1 year ago
Is this a vscode remote window? What does your ipynb code look like?
Also can you run the command "Log Working Copies" and copy the result from devtools (Help > Toggle Developer Tools)
Yes, this is on remote window.
That's all the code jupyter output to reproduce this problem.
Log Working Copies returns:
INFO [Working Copies] vscode-remote://ssh-remote+10.78.2.111/data/test/temp.py (typeId:
) vscode-remote://ssh-remote+10.78.2.111/data/test/debug.ipynb (typeId: notebook/jupyter-notebook) vscode-remote://ssh-remote+10.78.2.111/data_111/zhangyi/Data/test/temp.py (typeId: ) [Backups]
Any idea where data_111
comes from? Are there symlinks involved? We didn't make up that path
Yes, '/data' is a softlink for '/data_111/zhangyi/Data', and I open the project from '/data'. May be this caused the problem?发自我的手机-------- 原始邮件 --------发件人: Rob Lourens @.>日期: 2023年4月1日周六 02:38收件人: microsoft/vscode-jupyter @.>抄送: ease_zh @.>, Author @.>主 题: Re: [microsoft/vscode-jupyter] Jump to absolute path rather than relative path while debugging. (Issue #13224) Any idea where data_111 comes from? Are there symlinks involved? We didn't make up that path
—Reply to this email directly, view it on GitHub, or unsubscribe.You are receiving this because you authored the thread.Message ID: @.***>
@ease-zh so /data
is the symlink and /data_111
is the canonical path on disk? As a workaround, you might open /data_111
instead of /data
.
@int19h what's the expected behavior here when stepping into a symlinked file?
It can be configured to resolve symlinks or not by setting "resolveSymlinks" in the debug config, or by setting PYDEVD_RESOLVE_SYMLINKS=True
in environment variables. But the default is to not resolve, at least for paths that are reported to UI. Maybe that gets overwritten by something? The debug config setting should override the env, so that would be one thing to try.
@int19h Sorry for the late reply.
I tired to set PYDEVD_RESOLVE_SYMLINKS=False
in launch.json
, it worked for .py file debug, but how could I set this variable to .ipynb files?
To be more clear, I create a new file named temp2.py
:
from temp import temp
import os
print(os.environ['PYDEVD_RESOLVE_SYMLINKS'])
temp()
and a break was set on the last line.
With PYDEVD_RESOLVE_SYMLINKS=True
, when start debug, it directly jump to the absolute path, /data_111/.../temp2.py
.
With PYDEVD_RESOLVE_SYMLINKS=False
, when start debug, it stays in the relative path, /data/test/temp2.py
. And even step into the break point, it goto the relative path /data/test/temp.py
as suspected.
However, the launch.json
seems not affect the ipynb file, os.environ['PYDEVD_RESOLVE_SYMLINKS']
will raise an KeyError, so how can I make this work in jupyter process?
And, i'm not sure where is the debug config, and how can i set the "resolveSymlinks" .
Sorry @ease-zh we will have to make changes in the Jupyter extension in order to support this
Applies To
What happened?
When I debug in jupyter, it supposed to jump to my code in the working directory, but it actually open a new file editor from the absolute path. Simple code to reproduce: we have two files as
in
debug.ipynb
:in
temp.py
:With a break on line 2, debug the ipynb cell, it will open a file with absolute path rather than open the relative path, so I will have two edit windows for the same file.
And, breaks can add to both files, as:
Although this does not affect the code, but it is very annoying.
VS Code Version
版本: 1.76.2 (system setup) 提交: ee2b180d582a7f601fa6ecfdad8d9fd269ab1884 日期: 2023-03-14T17:55:54.936Z Electron: 19.1.11 Chromium: 102.0.5005.196 Node.js: 16.14.2 V8: 10.2.154.26-electron.0 OS: Windows_NT x64 10.0.19045 沙盒化: Yes
Jupyter Extension Version
v2023.3.1000851011
Jupyter logs
No response
Coding Language and Runtime Version
Python 3.10.6
Language Extension Version (if applicable)
Python v2023.4.1
Anaconda Version (if applicable)
No response
Running Jupyter locally or remotely?
Remote