mirror of
https://github.com/microsoft/debugpy.git
synced 2025-12-23 08:48:12 +00:00
check if os.file is available before using it
This commit is contained in:
parent
b00a812997
commit
e7bcae3ed8
2 changed files with 7 additions and 2 deletions
|
|
@ -155,7 +155,8 @@ class FilesFiltering(object):
|
|||
|
||||
# Make sure we always get at least the standard library location (based on the `os` and
|
||||
# `threading` modules -- it's a bit weird that it may be different on the ci, but it happens).
|
||||
roots.append(os.path.dirname(os.__file__))
|
||||
if hasattr(os, "__file__"):
|
||||
roots.append(os.path.dirname(os.__file__))
|
||||
roots.append(os.path.dirname(threading.__file__))
|
||||
if IS_PYPY:
|
||||
# On PyPy 3.6 (7.3.1) it wrongly says that sysconfig.get_path('stdlib') is
|
||||
|
|
|
|||
|
|
@ -88,7 +88,11 @@ def _get_library_dir():
|
|||
break
|
||||
|
||||
if library_dir is None or not os_path_exists(library_dir):
|
||||
library_dir = os.path.dirname(os.__file__)
|
||||
if hasattr(os, "__file__"):
|
||||
library_dir = os.path.dirname(os.__file__)
|
||||
|
||||
if library_dir is None:
|
||||
library_dir = "" # not possible to detect library_dir
|
||||
|
||||
return library_dir
|
||||
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue