diff --git a/jedi/_compatibility.py b/jedi/_compatibility.py index 36c7f0f5..1e13e7d3 100644 --- a/jedi/_compatibility.py +++ b/jedi/_compatibility.py @@ -365,6 +365,11 @@ try: except NameError: NotADirectoryError = IOError +try: + IsADirectoryError = IsADirectoryError +except NameError: + IsADirectoryError = IOError + try: PermissionError = PermissionError except NameError: diff --git a/jedi/api/project.py b/jedi/api/project.py index f8f32917..9bb38cc3 100644 --- a/jedi/api/project.py +++ b/jedi/api/project.py @@ -153,7 +153,7 @@ def _is_django_path(directory): try: with open(os.path.join(directory, 'manage.py'), 'rb') as f: return b"DJANGO_SETTINGS_MODULE" in f.read() - except (FileNotFoundError, NotADirectoryError, PermissionError): + except (FileNotFoundError, IsADirectoryError, PermissionError): return False return False @@ -169,7 +169,7 @@ def get_default_project(path=None): for dir in traverse_parents(check, include_current=True): try: return Project.load(dir) - except (FileNotFoundError, NotADirectoryError, PermissionError): + except (FileNotFoundError, IsADirectoryError, PermissionError): pass if first_no_init_file is None: