Page 1 of 1

RuntimeError: maximum recursion depth exceeded

Posted: Fri Aug 11, 2017 5:20 am
by Apollo22
Hello,

I encountered the following error : RuntimeError: maximum recursion depth exceeded

Code: Select all

  File "<stdin>", line 3, in <module>
  File "fsm.py", line 4, in <module>
  File "can.py", line 7, in <module>
  File "can_motion_commands.py", line 3, in <module>
  File "cam_analysing.py", line 8, in <module>
RuntimeError: maximum recursion depth exceeded
How could I get around this error without merging files together ?

PS : in the terminal, you show "Type "help()" for more information.". How can I call it ? I can't write anything on the terminal.

Re: RuntimeError: maximum recursion depth exceeded

Posted: Fri Aug 11, 2017 8:49 am
by Apollo22
I found a workaround.

Previously I only had in File 0 : " import File 1 "
Then File 1 imported File 2, File 2 imported File3, File 3 imported File 4 and File 4 import File 5.
And it printed " RuntimeError: maximum recursion depth exceeded "

The workaround is to import files that import less than 5 levels of import in it. In the previous exemple, import File 2, 3, 4, or 5 before File 1.

My import tree is messier because from 1 file I import several other files that imported each other. Allowing me to call global variables from any file. But I just have to first import the files that import other files with less than 5 level of recursion before importing those with more than 5.

Re: RuntimeError: maximum recursion depth exceeded

Posted: Fri Aug 11, 2017 12:00 pm
by kwagyeman
Wow, that's a lot of depth to your code. Good that you found a solution.