You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Path mappings not working with mixed windows-style/linux path slash #1301
I have a launch.json configuration to attach the debugger to a remote service.
This used to work for a long time, not sure when it stopped working exactly.
pydev debugger: unable to find translation for: "c:\path\to\workspace\Source\...\app.py" in ["C:\path\to\workspace/Source/","C:\path\to\workspace/Source"] (please revise your path mappings).
The local root is translated into C:\path\to\workspace/Source/ (notice the forward slashes at the end, and capital C )
While the pydev debugger is looking for c:\path\to\workspace\Source\...\app.py
I tried several ways to make it work, by replacing the ${workspaceRoot} variable with the value with lower c, and correct slashes.
But the only way I managed to make it work is to map exactly the full path of the specific file I want to debug. That's the only way I could see and hit the breakpoint on vscode window.
There are other ways I have tried, many variations with the slashes, but none of them worked. Also sometimes I don't receive the error above, but rather only Breakpoint in file that does not exist.
For this can you try adding "clientOS": "windows" to the configuration? This can occur when debugpy is not able to identify the client OS from the server side.
If you are using the latest version of python extension which is 2023.8.* and debugpy 1.6.7 and you are seeing this issue let us know. It could also be a bug in Python extension where the client OS is not being explictly sent to debugpy.
If you are using the latest version of python extension which is 2023.8.* and debugpy 1.6.7 and you are seeing this issue let us know. It could also be a bug in Python extension where the client OS is not being explictly sent to debugpy.
Hi! I am having the same problem. My python extension is 2023.10, but debugpy is 1.5.1 because I am using a rather old version of python. I cannot add "clientOS" to the configuration. I get: Property "clientOS" is not allowed. Below you can see my configuration file. Do you think I should downgrade the python extension? It's a bit more difficult to update the environment I am using.
{
// Use IntelliSense to learn about possible attributes.
// Hover to view descriptions of existing attributes.
// For more information, visit: https://go.microsoft.com/fwlink/?linkid=830387
"version": "0.2.0",
"configurations": [
{
"name": "Python: Remote Attach",
"type": "python",
"request": "attach",
"connect": {
"host": "localhost",
"port": 2599
},
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "."
}
],
"justMyCode": true,
}
]
}
No, this is used by multiple employees. I'm looking for a solution using {workspace} to avoid everyone changing the launch.json for each specific folder. In addition, I tried to declare clientOS, but I got the following warning, which is strange because I looked inside the debugpy code and it seems that this is a valid argument.
I would hazard a guess that VS code changed the result for ${workspaceFolder} to be upper case. Debugpy doesn't do the expansion of the ${workspaceFolder} variable AFAIK, that happens on the VS code side as Debugpy knows nothing of the workspace.
We'll likely have to do case insensitive lookups. Not sure why it wasn't already doing this for windows.
It looks like in Windows ${workspacefolder} would expand to C:\dev\test for me (without the trailing \). It looks like debugpy wouldn't like that, even with the case-insensitive path, as if I set my localRoot to "localRoot": "c:\\dev\\test", although debugpy doesn't spit out an error, I can't set breakpoints in my source.
I could fix the issue by adding \\ at the end of ${workspaceFolder} but that wouldn't be portable if I opened my project on a Linux platform.
I don't know if that's also an issue for debugpy or the VSCode plugin, how they interact, etc, etc. Admittedly, I haven't really dug into anything, just giving clues.
I can't reproduce the path or path escape problems myself, but in my situation the client OS is being sent. This part is crucial in the launch.json though:
"clientOS": "windows"
That makes the debugger on the server side normalize all casing and path separators.
The error that VS code shows is a red herring. It's simply because this item wasn't added here (I'll fix that in the next release):
"pathMappings": [
{
"localRoot": "${workspaceFolder}",
"remoteRoot": "." // <-- '.' is not supported here.
}
]
I'll submit something to make relative paths on the server paths resolve themselves before being used, but the current version requires the full remote path for path mappings to work. You can't just put 'remotePath': '.'.
You might also want to set this environment variable on the server:
set DEBUG_PYDEVD_PATHS_TRANSLATION=True
That will output more path information when this isn't working. For example it should print out the client os it thinks is being used:
I wasn't aware of the env variable. When set my pydev debugger output shows
pydev debugger: client OS: UNIX
pydev debugger: unable to find translation for: "c:\dev\test\Test.py" in ["c:/dev/test/"] (please revise your path mappings).
However, like andreeas26 , I'm using debugpy 1.5.1, as I'm on an embedded platform, and it's simply all I'm stuck with. Maybe the old version of debugpy doesn't support the clientOS parameter from VSCode?
Is there any other way to set this on my target (the debugpy server) directly?
The relative path part of this issue should be fixed in the latest build of debugpy. It should ship with VS code in a future version of the Python Debugger Extension or you can install your own debugpy from pypi.
Closing for now as the other problem really can't be fixed with an older debugpy.
Activity
gramster commentedon Jun 6, 2023
Karthik Nadig (@karthiknadig), does this seem like debugpy or PVSC?
karthiknadig commentedon Jun 6, 2023
For this can you try adding
"clientOS": "windows"to the configuration? This can occur when debugpy is not able to identify the client OS from the server side.karthiknadig commentedon Jun 6, 2023
If you are using the latest version of python extension which is 2023.8.* and debugpy 1.6.7 and you are seeing this issue let us know. It could also be a bug in Python extension where the client OS is not being explictly sent to debugpy.
andreeas26 commentedon Jun 9, 2023
Hi! I am having the same problem. My python extension is 2023.10, but debugpy is 1.5.1 because I am using a rather old version of python. I cannot add "clientOS" to the configuration. I get: Property "clientOS" is not allowed. Below you can see my configuration file. Do you think I should downgrade the python extension? It's a bit more difficult to update the environment I am using.
karthiknadig commentedon Jun 9, 2023
If you are seeing this you can ignore the warning:

Which version of python extension are you using?
andreeas26 commentedon Jun 12, 2023
devmessias commentedon Jan 7, 2025
Any news about this issue?
rchiodo commentedon Jan 7, 2025
Did you try this suggestion?
Putting the full path to a file in the path mappings?
devmessias commentedon Jan 7, 2025
No, this is used by multiple employees. I'm looking for a solution using {workspace} to avoid everyone changing the launch.json for each specific folder. In addition, I tried to declare clientOS, but I got the following warning, which is strange because I looked inside the debugpy code and it seems that this is a valid argument.
justynbell commentedon Jan 8, 2025
I'm having this same issue.
VSCode: 1.96.2
Python Debugger plugin: 2024-12-11
pydebug (on remote): 1.5.1
Putting the full path in localRoot works:
"localRoot": "c:\\dev\\test\\Using:
"localRoot": "${workspaceFolder}",Does not.When using the
${workspaceFolder}localRoot, pydebug spits out:pydev debugger: unable to find translation for: "c:\dev\test\Test.py" in ["C:\dev\test/", "C:\dev\test"] (please revise your path mappings).It's some issue with either the slashes, or the "c" vs "C", I don't know.
Is there a workaround, because hard-coding paths is not acceptable in my use-case either.
Using the
"clientOS": "windows"property doesn't change anything for me.rchiodo commentedon Jan 8, 2025
I would hazard a guess that VS code changed the result for
${workspaceFolder}to be upper case. Debugpy doesn't do the expansion of the${workspaceFolder}variable AFAIK, that happens on the VS code side as Debugpy knows nothing of the workspace.We'll likely have to do case insensitive lookups. Not sure why it wasn't already doing this for windows.
The translation happens here:
debugpy/src/debugpy/_vendored/pydevd/pydevd_file_utils.py
Line 761 in 02723de
justynbell commentedon Jan 8, 2025
It looks like in Windows
${workspacefolder}would expand toC:\dev\testfor me (without the trailing\). It looks like debugpy wouldn't like that, even with the case-insensitive path, as if I set my localRoot to"localRoot": "c:\\dev\\test", although debugpy doesn't spit out an error, I can't set breakpoints in my source.I could fix the issue by adding
\\at the end of${workspaceFolder}but that wouldn't be portable if I opened my project on a Linux platform.I don't know if that's also an issue for debugpy or the VSCode plugin, how they interact, etc, etc. Admittedly, I haven't really dug into anything, just giving clues.
3 remaining items
rchiodo commentedon Jan 9, 2025
I can't reproduce the path or path escape problems myself, but in my situation the client OS is being sent. This part is crucial in the launch.json though:
That makes the debugger on the server side normalize all casing and path separators.
The error that VS code shows is a red herring. It's simply because this item wasn't added here (I'll fix that in the next release):
https://github.com/microsoft/vscode-python-debugger/blob/1b6ac0d2836a6288131de032e68d56f4770640e0/package.json#L277
This is also a problem:
I'll submit something to make relative paths on the server paths resolve themselves before being used, but the current version requires the full remote path for path mappings to work. You can't just put
'remotePath': '.'.You might also want to set this environment variable on the server:
That will output more path information when this isn't working. For example it should print out the client os it thinks is being used:
justynbell commentedon Jan 10, 2025
Thanks for following up with this Rich Chiodo (@rchiodo) and helping us out.
I wasn't aware of the env variable. When set my pydev debugger output shows
However, like andreeas26 , I'm using debugpy 1.5.1, as I'm on an embedded platform, and it's simply all I'm stuck with. Maybe the old version of debugpy doesn't support the clientOS parameter from VSCode?
Is there any other way to set this on my target (the debugpy server) directly?
rchiodo commentedon Jan 10, 2025
Sorry but with 1.51, there isn't a way to set that.
You can search for it here:
https://github.dev/microsoft/debugpy/tree/v1.5.1/src/debugpy
It wasn't even part of the source at that point
rchiodo commentedon Jan 10, 2025
You might try 'ideOS'? It looks like that served the same purpose. Not sure if it will work
rchiodo commentedon Jan 15, 2025
The relative path part of this issue should be fixed in the latest build of debugpy. It should ship with VS code in a future version of the Python Debugger Extension or you can install your own debugpy from pypi.
Closing for now as the other problem really can't be fixed with an older debugpy.
rchiodo commentedon Jan 15, 2025
Take that back, our release to PyPI failed when it looked like it succeeded. Fix will be coming after we resolve that problem.
rchiodo commentedon Jan 16, 2025
PyPI release succeeded. v1.8.12 is now available
fix(deps): update backend dependencies (patch) (patch)
Merge branch 'renovate/patch-backend-dependencies' into 'main'