3π
β
It was because of incorrect syntax elsewhere in the project, that caught multiple exceptions like this:
try:
do_something()
except AttributeError, Profile.DoesNotExist:
pass
When it should have been this:
try:
do_something()
except (AttributeError, Profile.DoesNotExist):
pass
What was happening was that when this happened, AttributeError
got assigned to Profile.DoesNotExist
in memory, so when it was raised later, it was the wrong exception.
Thanks to this post for helping.
π€seddonym
Source:stackexchange.com