RuntimeError Raised when an error is detected that does not fall into any of the other categories.
def foo(): try: foo() except RuntimeError, e: print e print " Runtime Error occurred due to exceeded maximum recursion depth "
Here's how we catch a RuntimeError caused by exceeding the recursion limit in python
And if you want to call your function by recursion limit, you can do the following
import sys def foo(): try: foo() except RuntimeError, e: sys.setrecursionlimit(1200) foo()
But it is always not recommended to change the recursion limit, but very small changes are allowed in the recursion limit
naveen tamanam
source share