RuntimeError: maximum recursion depth exceeded while calling a Python object

Discuss how to use the Ren'Py engine to create visual novels and story-based games. New releases are announced in this section.
Forum rules
This is the right place for Ren'Py help. Please ask one question per thread, use a descriptive subject like 'NotFound error in option.rpy' , and include all the relevant information - especially any relevant code and traceback messages. Use the code tag to format scripts.
Post Reply
Message
Author
User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

RuntimeError: maximum recursion depth exceeded while calling a Python object

#1 Post by xavimat »

I don't know what I'm doing wrong.
This error happens when loading a save:
RuntimeError: maximum recursion depth exceeded while calling a Python object

I have defined classes in my game and some of them are subclasses, but I don't think there are that complex. I don't get where the error come from.
traceback.txt
(47.48 KiB) Downloaded 119 times
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

kivik
Miko-Class Veteran
Posts: 786
Joined: Fri Jun 24, 2016 5:58 pm
Contact:

Re: RuntimeError: maximum recursion depth exceeded while calling a Python object

#2 Post by kivik »

May not be the complexity with the classes but somehow you've created a recursion inside one of the functions? Here's an example of someone accidentally creating recursion with a setter function: https://stackoverflow.com/questions/366 ... -when-call

Maybe you've got that somewhere in your code?

User avatar
Remix
Eileen-Class Veteran
Posts: 1628
Joined: Tue May 30, 2017 6:10 am
Completed: None... yet (as I'm still looking for an artist)
Projects: An un-named anime based trainer game
Contact:

Re: RuntimeError: maximum recursion depth exceeded while calling a Python object

#3 Post by Remix »

I presume that you are loading a fresh save... one saved after doing all the delete persistent stuff, play a bit of game, save it, load it?

As the save actually saves I'd conclude the objects are actually pickle-able so the culprit likely isn't there (though you could try config.use_cpickle = False to see if the traceback is improved)

With the recursion being __getattr__ ... Are you overloading that method (or __getattribute__ ) in your classes? (recursing getattr is all too easy if using super without fully wrapping the call in if:else logic) Are you using any getstate setstate methods? Are you extending object or a Ren'Py base class?

As codecs is a bytecode file I cannot even look through that to see if the recursing getattr in there can shed more light.
The above is therefore just guesswork on the hope that a getattr in that codecs file might also be calling a getattr in one of your classes...
Frameworks & Scriptlets:

User avatar
xavimat
Eileen-Class Veteran
Posts: 1461
Joined: Sat Feb 25, 2012 8:45 pm
Completed: Yeshua, Jesus Life, Cops&Robbers
Projects: Fear&Love
Organization: Pilgrim Creations
Github: xavi-mat
itch: pilgrimcreations
Location: Spain
Discord: xavimat
Contact:

Re: RuntimeError: maximum recursion depth exceeded while calling a Python object

#4 Post by xavimat »

Thanks to both of you. (Yes, fresh saves after deleting persistent, etc.)
I was using setattr inside the __init__ and some @property and maybe I have messed up using the same name for two variables.
I'm also using a lot of __("") functions (with double _), that could be translating strings more than once.
I'm not sure where the error came from.
Anyway, the error is not showing again, probably because I've simplified the __init__.
Comunidad Ren'Py en español: ¡Únete a nuestro Discord!
Rhaier Kingdom A Ren'Py Multiplayer Adventure Visual Novel.
Cops&Robbers A two-player experiment | Fear&Love Why can't we say I love you?
Honest Critique (Avatar made with Chibi Maker by ~gen8)

Post Reply

Who is online

Users browsing this forum: Dark12ose, Sugar_and_rice