RuntimeError: maximum recursion depth exceeded

Discussion related to "under the hood" OpenMV topics.
Apollo22
Posts: 4
Joined: Fri Aug 11, 2017 5:14 am

RuntimeError: maximum recursion depth exceeded

Postby Apollo22 » Fri Aug 11, 2017 5:20 am

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.
Apollo22
Posts: 4
Joined: Fri Aug 11, 2017 5:14 am

Re: RuntimeError: maximum recursion depth exceeded

Postby Apollo22 » Fri Aug 11, 2017 8:49 am

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.
User avatar
kwagyeman
Posts: 916
Joined: Sun May 24, 2015 2:10 pm

Re: RuntimeError: maximum recursion depth exceeded

Postby kwagyeman » Fri Aug 11, 2017 12:00 pm

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

Return to “Technical Discussion”

Who is online

Users browsing this forum: No registered users and 2 guests