vi_me
vi_me

Reputation: 408

Mypy linting in VSCode Errors out with "Error constructing plugin instance of NewSemanalDRFPlugin"

Trying to run Mypy linter in VSCode, always getting the same error in the output...

The root of the Django project and the workspace directory are different.

##########Linting Output - mypy##########
Error constructing plugin instance of NewSemanalDRFPlugin

python3.8.5

Django with DRF

Upvotes: 1

Views: 1009

Answers (2)

Petr Dlouhý
Petr Dlouhý

Reputation: 927

I have got this error when using django-stubs and djangorestframework-stubs together. It is probably bug in one of these libraries: https://github.com/typeddjango/django-stubs/issues/672

There is workaround to this (careful, because it can hide other errors). Run mypy with (the -O parameter disables assert checks):

python -O -m mypy application/

Upvotes: 0

vi_me
vi_me

Reputation: 408

PYTHONPATH has to contain the root of your django project, or Mypy has to be called from the root of the django project.

Upvotes: 0

Related Questions