import sys try : raise ValueError, "Got an error" except : if sys.exc_type == ValueError : print "Value Error" else : print "Something else"