diff --git a/src/debugpy/adapter/__main__.py b/src/debugpy/adapter/__main__.py index e18ecd560..dd784cb57 100644 --- a/src/debugpy/adapter/__main__.py +++ b/src/debugpy/adapter/__main__.py @@ -211,7 +211,13 @@ def _parse_argv(argv): # future imports of it or its submodules will resolve accordingly. if "debugpy" not in sys.modules: # Do not use dirname() to walk up - this can be a relative path, e.g. ".". - sys.path[0] = sys.path[0] + "/../../" + if os.name == "nt": + import pathlib + + windows_path = pathlib.Path(sys.path[0]) + sys.path[0] = str(windows_path.parent.parent) + else: + sys.path[0] = sys.path[0] + "/../../" __import__("debugpy") del sys.path[0]