diff --git a/src/debugpy/_vendored/pydevd/pydevd_file_utils.py b/src/debugpy/_vendored/pydevd/pydevd_file_utils.py index ab13b2bc..7ca38344 100644 --- a/src/debugpy/_vendored/pydevd/pydevd_file_utils.py +++ b/src/debugpy/_vendored/pydevd/pydevd_file_utils.py @@ -89,10 +89,13 @@ def _get_library_dir(): if library_dir is None or not os_path_exists(library_dir): if hasattr(os, "__file__"): + # "os" is a frozen import an thus "os.__file__" is not always set. + # See https://github.com/python/cpython/pull/28656 library_dir = os.path.dirname(os.__file__) - - if library_dir is None: - library_dir = "" # not possible to detect library_dir + else: + # "threading" is not a frozen import an thus "threading.__file__" is always set. + import threading + library_dir = os.path.dirname(threading.__file__) return library_dir