Python: 'module' object is not callable
exception, python
Solution
This is why you want to keep your module names lower-cased. :-)
from exception.UniqueConstraintException import UniqueConstraintException
You imported the module, no the class defined inside of the module.
Problem
I have an exception class defined ``` #####UNIQUE CONSTRAINT EXCEPTION#########################################################3 class UniqueConstraintException (Exception): def __init__(self, value): self.value = value def __str__(self): return repr('Failed unique property. Property name: ' + self.value) ``` The file name is: "UniqueConstraintException.py" and package name: "exception" I'm importing and using it in this way: ``` from exception import UniqueConstraintException raise UniqueConstraintException(prop_key) ``` And get this error: ``` TypeError: 'module' object is not callable ``` What am i doing wrong?