↧
Answer by JPG for Catch specific errors in python
type(e) does not return a string. Note that(<class 'django.contrib.auth.models.User.DoesNotExist'> != 'django.contrib.auth.models.User.DoesNotExist')The if condition should be if type(e) ==...
View ArticleCatch specific errors in python
I was trying to catch a specific exception:username = 'myuser'try: user = User.objects.get(username=username) print(user)except Exception as e: if...
View Article
More Pages to Explore .....