Skip to content

Commit

Permalink
If pydevd deps cannot be imported, add itself to the PYTHONPATH. Fixes
Browse files Browse the repository at this point in the history
  • Loading branch information
fabioz committed Mar 25, 2021
1 parent 0dd74a7 commit 2f61bab
Showing 1 changed file with 9 additions and 3 deletions.
12 changes: 9 additions & 3 deletions src/debugpy/_vendored/pydevd/pydevd.py
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,13 @@
import weakref
import getpass as getpass_mod
import functools
import pydevd_file_utils
try:
import pydevd_file_utils
except ImportError:
# On the first import of a pydevd module, add pydevd itself to the PYTHONPATH
# if its dependencies cannot be imported.
sys.path.append(os.path.dirname(os.path.abspath(__file__)))
import pydevd_file_utils

from _pydev_bundle import pydev_imports, pydev_log
from _pydev_bundle._pydev_filesystem_encoding import getfilesystemencoding
Expand Down Expand Up @@ -697,7 +703,7 @@ def accept_directory(absolute_filename, cache={}):
if glob_matches_path(absolute_filename, include_pattern):
cache[absolute_filename] = True
return True

# Then exclude what we don't want
for exclude_pattern in exclude_patterns:
if glob_matches_path(absolute_filename, exclude_pattern):
Expand All @@ -717,7 +723,7 @@ def accept_file(absolute_filename, cache={}):
if glob_matches_path(absolute_filename, include_pattern):
cache[absolute_filename] = True
return True

# Then exclude what we don't want
for exclude_pattern in exclude_patterns:
if glob_matches_path(absolute_filename, exclude_pattern):
Expand Down

0 comments on commit 2f61bab

Please sign in to comment.