Skip to content

Commit

Permalink
Don't crash if Django isn't installed
Browse files Browse the repository at this point in the history
DjangoInstalledChecker will catch the condition and inform the user,
but we should not crash before that checker gets executed.
  • Loading branch information
atodorov committed Nov 11, 2021
1 parent 1024ca7 commit 08fad37
Showing 1 changed file with 6 additions and 3 deletions.
9 changes: 6 additions & 3 deletions pylint_django/checkers/foreign_key_strings.py
Original file line number Diff line number Diff line change
Expand Up @@ -78,9 +78,12 @@ def open(self):
# must wait until some module is inspected to be able to raise... so that
# state is stashed in this property.

from django.core.exceptions import ( # pylint: disable=import-outside-toplevel
ImproperlyConfigured,
)
try:
from django.core.exceptions import ( # pylint: disable=import-outside-toplevel
ImproperlyConfigured,
)
except ModuleNotFoundError:
return

try:
import django # pylint: disable=import-outside-toplevel
Expand Down

0 comments on commit 08fad37

Please sign in to comment.