RuntimeError: maximum recursion depth exceeded

Hello,

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

  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.

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.

Wow, that’s a lot of depth to your code. Good that you found a solution.

Is there a way for future implementation to increase the maximum recursion depth ?

For information, this is my current import tree. I manage to do with the current recursion depth, but it would be easier if it was bigger.

This is a limit from the MicroPyhton environment. I’ll need to search through the c code to find what the limit is set too. You can also ask this question on the MicroPyhton forums and they may be able to answer this more quickly.