Ive written a code which will end up some desired outcome but there is a very high probability for the code to face "stack overflow error".
Is there anyway to restart the code automatically after "stack overflow error"?
I tried "try"-and-"except" but it didn't work.
update:
Someone asked for the code i cant add the code entirely but it is the last part of the code which is consist of a function which includes a series of functions (total number of functions needs to be equal to number of teams [which is a a list] minus 1) if i run the code with seven or eight functions it would 100 percent work but as i run the code with more functions in the series the probability of facing stack overflow error will rise significantly.
There will be some possible desired outcome but there would be a lot of possible ways to face stack overflow error too.
def draw(destinationfile, teams):
open(destinationfile,"w").close()
all_matches(teams)
draw_reg(1, destinationfile)
draw_reg(2, destinationfile)
draw_irreg(3, destinationfile)
draw_reg(4, destinationfile)
draw_irreg(5, destinationfile)
draw_irreg(6, destinationfile)
draw_reg(7, destinationfile)
draw_irreg(8, destinationfile)
draw_reg(9, destinationfile)
draw_irreg(10, destinationfile)
draw_irreg(11, destinationfile)
draw_reg(12, destinationfile)
draw_reg(13, destinationfile)
draw("draw result.txt", leagueteams)