Home > Software engineering >  ImportError: cannot import name 'ExceptionReporterFilter'
ImportError: cannot import name 'ExceptionReporterFilter'

Time:03-07

Getting an error in my Django project.

ImportError: cannot import name 'ExceptionReporterFilter'

I'm using it in the following class

from django.views.debug import ExceptionReporterFilter


class JSONExceptionReporterFilter(ExceptionReporterFilter):
    pass

I'm using Django==2.2.1

What can be the fix for this?

CodePudding user response:

I suspect you are actually using a newer version of Django where they renamed it to SafeExceptionReporterFilter or else your import would work as you are correct it is in 2.2.1 as you can see in the code https://github.com/django/django/blob/2.2.1/django/views/debug.py#L109

You can look to see what version of django you are running with the following in your code (near your error)

import django
print(django.__version__)
  • Related