try: if '1' != 1: raise "someError" else: print("someError has not occurred") except "someError": print ("someError has occurred")