maximum recursion depth exceeded

Mike Romberg romberg at
Tue Mar 4 19:52:36 CET 2003

  I'm attempting to try and gracefully handle situations where
infinite recursion can occur in scripts supplied to our system by our
users.  To do this I've tried the following:

    eval("Some code which might recurse")
except exceptions.RuntimeError:
    # Handle error

  When I supply a string which causes infinite recursion, I see these
messages on the console:

Exception exceptions.RuntimeError: 'maximum recursion depth exceeded'
in  ignored

  But I can't seem to catch the exceptions.  Is there something
special about this exception?  Or am I just missing something obvious
(which I have been know to do from time to time).


Mike Romberg (romberg at

More information about the Python-list mailing list