Skip to content
Advertisement

Fatal Python error: Cannot recover from stack overflow. In python

I was trying to make my own terminal and when I was adding the feature to make your own functions and use them I got this error.

Fatal Python error: Cannot recover from stack overflow.

EDIT:

The problem was that the function it caused a infinite loop.

My suggestion to everyone else is to check and make sure that a function is not calling itself

Advertisement

Answer

The error you’re getting indicates that you have a function called do which calls itself, probably in an infinite loop. When a function does that too many times (calls itself inside itself, which causes it to call itself inside itself inside itself…) you get what’s called a “stack overflow”.

If you don’t do that, you won’t get this error.

Advertisement