remote root path is stucked as /root Follow
I set ssh remote interpreter and deployment path
and I set root path '/' as always
I executed debug session, and got error as follows:
Traceback (most recent call last):
File "/root/.pycharm_helpers/pydev/pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "/root/.pycharm_helpers/pydev/_pydev_imps/_pydev_execfile.py", line 11, in execfile
stream = tokenize.open(file) # @UndefinedVariable
File "/opt/conda/lib/python3.8/tokenize.py", line 392, in open
buffer = _builtin_open(filename, 'rb')
FileNotFoundError: [Errno 2] No such file or directory: '/home/user/sidong/A-ViT/models_act.py'
i confirmed my files exist in remote path corectly.
using debugging session, i checked current path (root path) using pwd
then I got '/root' path, not what I set ('/')
so my debugger sessions always gets FileNotFoundError
Is there any solution?
Please sign in to leave a comment.
The stack trace comes from a remote python process which says it can't find the file with an absolute path of `/home/user/sidong/A-ViT/models_act.py`
Are you sure this file exists and has the read access for everyone? Could you provide the output of `ls -la /home/user/sidong/A-ViT/models_act.py` from the remote host?
Thank you for your comment.
I saw a strange problem.
I mainly set up my interpreter environment with ssh. The python interpreter of this project is Remote python 3.8.12 in my server (I call server A).
However, in debug configuration, I saw that the interpreter is incorrectly selected as Remote python 3.8.8 (an interpreter of server B I made before..) So I replaced it with the correct interpreter and saved it. but when I revisit the configuration window, it is not changed and is fixed as 3.8.8.
That's why I saw FileNotFoundError. When the debugger session starts, it always accesses the incorrect interpreter (in server B), so there's no file we find.
Yes, I suspected that you may be accessing another host. Regarding the inability to change the interpreter in the run/debug configuration, it could be related to https://youtrack.jetbrains.com/issue/PY-56269/Unable-to-switch-between-different-remote-interpreters-if-executable-paths-are-identical
The solution is to either remove one of the interpreters, or disable Targets API (a new interpreter implementation introduced in 2022.2) until the issue is fixed:
1) Go to **Help | Find Action...** and search for "Registry...".
2) In the registry, search for `python.use.targets.api` and disable it.
3) Reconfigure your project interpreter.