When trying to print StoneSoup objects that recursively contain a large number of other objects (e.g. Tracks), or debugging scripts that contain such objects, a RecursionError is thrown, e.g.:
Traceback (most recent call last):
File "C:\Program Files\JetBrains\PyCharm 2023.1\plugins\python\helpers\pydev\pydevd.py", line 2195, in <module>
main()
File "C:\Program Files\JetBrains\PyCharm 2023.1\plugins\python\helpers\pydev\pydevd.py", line 2177, in main
globals = debugger.run(setup['file'], None, None, is_module)
File "C:\Program Files\JetBrains\PyCharm 2023.1\plugins\python\helpers\pydev\pydevd.py", line 1489, in run
return self._exec(is_module, entry_point_fn, module_name, file, globals, locals)
File "C:\Program Files\JetBrains\PyCharm 2023.1\plugins\python\helpers\pydev\pydevd.py", line 1496, in _exec
pydev_imports.execfile(file, globals, locals) # execute the script
File "C:\Program Files\JetBrains\PyCharm 2023.1\plugins\python\helpers\pydev\_pydev_imps\_pydev_execfile.py", line 18, in execfile
exec(compile(contents+"\n", file, 'exec'), glob, loc)
File "C:\Users\sglvladi\Workspace\GitHub\Stone-Soup-tmp\examples\recursion_error_example.py", line 153, in <module>
print(track)
File "C:\Users\sglvladi\Workspace\GitHub\Stone-Soup-tmp\stonesoup\base.py", line 457, in __repr__
rep = Base._repr.whitespace_remove(max_len_whitespace, value)
File "C:\Users\sglvladi\Workspace\GitHub\Stone-Soup-tmp\stonesoup\base.py", line 248, in whitespace_remove
return cls.whitespace_remove(maxlen_whitespace, val)
File "C:\Users\sglvladi\Workspace\GitHub\Stone-Soup-tmp\stonesoup\base.py", line 248, in whitespace_remove
return cls.whitespace_remove(maxlen_whitespace, val)
File "C:\Users\sglvladi\Workspace\GitHub\Stone-Soup-tmp\stonesoup\base.py", line 248, in whitespace_remove
return cls.whitespace_remove(maxlen_whitespace, val)
[Previous line repeated 986 more times]
File "C:\Users\sglvladi\Workspace\GitHub\Stone-Soup-tmp\stonesoup\base.py", line 239, in whitespace_remove
@classmethod
RecursionError: maximum recursion depth exceeded while calling a Python object
This seems to happen because of a recursive call to the BaseRepr.whitespace_remove() method (see here).
A script that demonstrates this error can be found here.
When trying to print StoneSoup objects that recursively contain a large number of other objects (e.g.
Tracks
), or debugging scripts that contain such objects, a RecursionError is thrown, e.g.:This seems to happen because of a recursive call to the
BaseRepr.whitespace_remove()
method (see here).A script that demonstrates this error can be found here.