Repeated infinite loop in an innocent image declaration line

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
Showakun
Newbie
Posts: 19
Joined: Tue Sep 04, 2018 1:04 pm
Contact:

Repeated infinite loop in an innocent image declaration line

#1 Post by Showakun »

This problem has been bothering me for a long while now. After some time the line at the beginning of the game where I declared one of the images started beginning to give me an infinite loop error. What's weird is that that line worked properly for A LONG TIME before it suddenly started bothering me. Here's the error:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "game/beginning.rpy", line 29, in script
    image woodland1 = "sprites/woodland1.png"
Exception: Possible infinite loop.

-- Full Traceback ------------------------------------------------------------

Full traceback:
  File "game/beginning.rpy", line 29, in script
    image woodland1 = "sprites/woodland1.png"
  File "C:\Users\MZ\Documents\renpy-6.15.4-sdk\renpy\execution.py", line 59, in check_infinite_loop
    raise Exception("Possible infinite loop.")
Exception: Possible infinite loop.

Windows-8-6.2.9200
Ren'Py 7.3.5.606
F.R.S.T 1.0
Tue Apr 06 07:06:16 2021
What's also weirder that I tried to rename the image in question and the way it is declared but (I renamed it 'forest1') but it still poses here under its OLD NAME - woodland1. I also deleted that old image from sprites so it can't be causing problems. When I click 'ignore' at the error, the game CONTINUES AS NORMAL, so basically I don't see any proof of actual loops happening.

I don't know much about loops as a newbie. Can someone please tell me what's going on?

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Repeated infinite loop in an innocent image declaration line

#2 Post by Ocelot »

Did you rename or delete one of your script files recently?
< < insert Rick Cook quote here > >

Showakun
Newbie
Posts: 19
Joined: Tue Sep 04, 2018 1:04 pm
Contact:

Re: Repeated infinite loop in an innocent image declaration line

#3 Post by Showakun »

Ocelot wrote: Fri Apr 23, 2021 7:11 am Did you rename or delete one of your script files recently?
No, not recently but then again, this problem is also not recent. I'd say I had something like 3-5 *.rpy script files added (and renamed, obviously, because I don't use default names) before it started bothering me. It definitely didn't happen the first time I renamed a script file. (I am sorry but I don't remember at which point it happened, I had thought I'd be able to solve it easily back then) I also constantly swap outdated sprites for new ones but please note that only this line ever gives me the error and not other declarations, ever. And, in fact, it's the only error which I don't know the solution for and which persists.

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Repeated infinite loop in an innocent image declaration line

#4 Post by Ocelot »

Navigate to your game directory and delete all *.rpyc files here (not *.rpy files — those are your scripts!). Check if the problem persists. Things remaining the same even if you change something are first sign of a rogue rpyc file laying around.
< < insert Rick Cook quote here > >

Showakun
Newbie
Posts: 19
Joined: Tue Sep 04, 2018 1:04 pm
Contact:

Re: Repeated infinite loop in an innocent image declaration line

#5 Post by Showakun »

Tried to delete all rpyc (NOT rpys) files, but when I tried to load a save to see if this error persits, it gave me another kind of exception:

Code: Select all

Exception: Couldn't find a place to stop rolling back. Perhaps the script changed in an incompatible way?
So, in short, I forgot that deleting rpycs will make old saves inaccessible. Perhaps I didn't understand your advice and you meant that I will have to create new saves to test this because they will be inaccessible because of deleted rpycs ? In that case, I won't be able to test it in a long time because I can't start saving from scratch now for other reasons, especially since this 'infinite loop' error is a persistent problem but it's difficult to replicate because it happens at random in random parts of the game and NOT in every playthough. Thank you anyway and sorry for being dumb. :)

User avatar
Ocelot
Lemma-Class Veteran
Posts: 2384
Joined: Tue Aug 23, 2016 10:35 am
Github: MiiNiPaa
Discord: MiiNiPaa#4384
Contact:

Re: Repeated infinite loop in an innocent image declaration line

#6 Post by Ocelot »

Showakun wrote: Fri Apr 23, 2021 8:37 am So, in short, I forgot that deleting rpycs will make old saves inaccessible.
Usually they don't get inaccessible, because rpyc will be regenerated from RPY files anyway. Inability to load is likely due to existence of rogue rpyc getting loaded and baked into save file.

For the future, if you ever delete or rename a script file, always remove its associated RPYC file. I will save a lot of headache later.
< < insert Rick Cook quote here > >

Showakun
Newbie
Posts: 19
Joined: Tue Sep 04, 2018 1:04 pm
Contact:

Re: Repeated infinite loop in an innocent image declaration line

#7 Post by Showakun »

Ocelot wrote: Fri Apr 23, 2021 8:48 am
Showakun wrote: Fri Apr 23, 2021 8:37 am So, in short, I forgot that deleting rpycs will make old saves inaccessible.
Usually they don't get inaccessible, because rpyc will be regenerated from RPY files anyway. Inability to load is likely due to existence of rogue rpyc getting loaded and baked into save file.

For the future, if you ever delete or rename a script file, always remove its associated RPYC file. I will save a lot of headache later.
Thank you. So it's not normal after all, ahaha? :lol: Weird thing is, I am 80% sure I deleted those old rpycs way back, when I renamed them. Perhaps I missed some. Last question - so yes, I will have to make new saves to see what happens with that error? Or is there a way to load a save without old rpycs influencing them (sorry if it's dumb, again)?

uncoded
Regular
Posts: 27
Joined: Fri Apr 09, 2021 10:29 am
Contact:

Re: Repeated infinite loop in an innocent image declaration line

#8 Post by uncoded »

.pyc (and I suppose .rpyc) files are just compiled code that your computer executes.
The initial state of your game is store in save files, but those are not executable code.

If you cleaned up everything properly, your save files should work properly with your new (cleaned up) code.
Of course, YMMV depending of what you already implemented in your game and the amount of modifications you made between now and the moment your "rogue .rpyc files" were generated.
🐾

Post Reply

Who is online

Users browsing this forum: No registered users