Skip to content

maximum recursion depth exceeded while calling a Python object

have you ever ran into an error that you remember getting before but don’t remember how you fixed it or why it happened? This is my attempt to break that loop for this error.

my project was structured as such

/gateway.py
/gatewayTest.py

I had more modules and classes to add so I wanted to make a package.

/serverSupport
__init__.py
gateway.py
gatewayTest.py

When I ran the test I received a great gift! Yippie!

Finding files... done.
Importing test modules ... done.

Exception RuntimeError: ‘maximum recursion depth exceeded while calling a Python object’ in ignored
Exception RuntimeError: ‘maximum recursion depth exceeded while calling a Python object’ in ignored
Exception RuntimeError: ‘maximum recursion depth exceeded while calling a Python object’ in ignored
Exception RuntimeError: ‘maximum recursion depth exceeded while calling a Python object’ in ignored
Exception RuntimeError: ‘maximum recursion depth exceeded while calling a Python object’ in ignored
Exception RuntimeError: ‘maximum recursion depth exceeded while calling a Python object’ in ignored

so it looks like that gatewayTest.py is trying to extend itself, repeatedly. I’ll move the test out of the package so when the test tries to load the package it doesn’t try to load itself which would try to load the package which would load itself.


/serverSupport
__init__.py
gateway.py

/gatewayTest.py

This works! but it would rather keep the tests in their own directory or with the package..

The following fails with the same recursion error


/serverSupport
__init__.py
gateway.py

/test
gatewayTest.py

I’m annoyed. fix later.

Post a Comment

Your email is never published nor shared. Required fields are marked *
*
*