Quantcast
Channel: Catch specific errors in python - Stack Overflow
Browsing all 2 articles
Browse latest View live

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 Article


Catch 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
Browsing all 2 articles
Browse latest View live




<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>