Maximum recursion depth exceeded

I get this error message on any script I run, any ideas?

org.eclipse.ease.ScriptExecutionException: Traceback (most recent call last):
File “workspace://Python4Capella/java_api/Java_API.py”, line 7, in
#
File “<…>”, line 116, in loadModule
RecursionError: maximum recursion depth exceeded

Python has a limit regarding the allowed number of recursion. This can prevent infinite loop but most language will crash at some point.

You can check the current limit with:

import sys
print(sys.getrecursionlimit())

You can also change this limit:

sys.setrecursionlimit(1500)

If this doesn’t solve your issue you should consider changing your recursive code to an iterative code if possible.

I realized what caused the issue. I’ve been working with the add-on RequirementVP and it seems when I include the requirement api to the capella simplified api it caused some sort of problem. I’ll respond once I find what apart of the inclusion is causing this recursion issue.

1 Like

Issue (I felt really stupid when I figured it out): Capella.py includes requirement.py → requirement.py includes Capella.py. So compiler is just jumping back and forth between the files at the header creating an infinite loop…

It’s not the case in the original version of capella.py but there was an issue that could fixed by importing requirement.py. But it should be included in the script causing this error to avoid this kind of loop.

And don’t worry we all have been there :slight_smile:

Does Capella have a built-in debugger that allows step-in so I can maybe avoid future unnecessary form questions?

I was not able to debug Python4Capella scripts using EASE lately. At some point I was able to debug but I don’t know why it worked… If you have some results let me know.

1 Like