Page 1 of 1

Try to load game but get "uncaught exception"

Posted: Tue Nov 26, 2019 8:03 pm
by willanik
Hi people,
I have just added content to a game I am working on. The game has behaved well until today when I hit load. Rather than it starting the game, I got the following message:


I'm sorry, but an uncaught exception occurred.

After initialization, but before game start.
File "renpy/common/00voice.rpy", line 360, in voice_interact
if _menu:
NameError: global name '_menu' is not defined

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

Full traceback:
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\bootstrap.py", line 295, in bootstrap
renpy.main.main()
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\main.py", line 430, in main
renpy.game.script.report_duplicate_labels()
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\script.py", line 890, in report_duplicate_labels
if renpy.parser.report_parse_errors():
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\parser.py", line 2543, in report_parse_errors
renpy.display.error.report_parse_errors(full_text, error_fn)
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\display\error.py", line 179, in report_parse_errors
error_fn=error_fn,
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\game.py", line 280, in invoke_in_new_context
return callable(*args, **kwargs)
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\display\error.py", line 43, in call_exception_screen
return renpy.ui.interact(mouse="screen", type="screen", suppress_overlay=True, suppress_underlay=True)
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\ui.py", line 285, in interact
rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\display\core.py", line 2519, in interact
i()
File "renpy/common/00voice.rpy", line 360, in voice_interact
if _menu:
NameError: global name '_menu' is not defined

Windows-7-6.1.7601-SP1
Ren'Py 6.99.12.4.2187
New game II 0.10

I rebooted and the same thing happened. I have no idea what else to do to fix this! I am not using the latest version of Ren’py but this has not caused me any difficulties before.

I would be very grateful for any advice that more experienced developers can can give me.

Re: Try to load game but get "uncaught exception"

Posted: Wed Nov 27, 2019 2:42 am
by Per K Grok
willanik wrote: Tue Nov 26, 2019 8:03 pm Hi people,
I have just added content to a game I am working on. The game has behaved well until today when I hit load. Rather than it starting the game, I got the following message:


I'm sorry, but an uncaught exception occurred.

After initialization, but before game start.
File "renpy/common/00voice.rpy", line 360, in voice_interact
if _menu:
NameError: global name '_menu' is not defined

-----

So it would seem something you have added triggers an exception, and it seems like it is the use of the variable _menu without having it defined.

Can you find the variable _menu in your code?

If not,
do you know what part of your code that has been added after the last time the game worked. If you add # in front of those lines, does the game work now?

Re: Try to load game but get "uncaught exception"

Posted: Wed Nov 27, 2019 10:56 am
by Donmai
A common cause to this error is having duplicate labels in your script (two or more labels with the same name) or two copies of the same script in your game folder. Indentation errors can also trigger that error.

Re: Try to load game but get "uncaught exception"

Posted: Thu Nov 28, 2019 7:30 pm
by willanik
Thanks very much for the suggestions:

• I have worked through my text for misplaced indents and label duplications and have not found any yet (although I did find a couple of other errors that I’d previously missed!)

• I looked for _menu, but I cannot find it and it is not something I use.

• Good idea to add # to the new lines but unfortunately there are a couple thousand, so this might be my avenue of last resort! Maybe I could cut it all out, then if the game works I could selectively reintroduce it until I get the problem again?

I wish I could make more sense out of the traceback advice but it refers to actions and places that I simply cannot find. Grateful for any other ideas the people have.

Re: Try to load game but get "uncaught exception"

Posted: Thu Nov 28, 2019 9:33 pm
by Remix
Did you upgrade Ren'Py recently?

I would suggest doing a Create New Project and piece-by-piece adding files into it until you find one that doesn't work... basically, from a clean (working) project, add files until it breaks as a way of tracking down the culprit...

Re: Try to load game but get "uncaught exception"

Posted: Sat Nov 30, 2019 9:08 am
by Donmai
Normally, you won't find the _menu label in your scripts because that's a Ren'Py internal reserved name. We cannot use names starting with 00 or a single underscore, because they're reserved names. BTW check that you haven't used reserved names for any label or variable you may have created.
File "C:\home\game version 211119\renpy-6.99.12.3-sdk\renpy\main.py", line 430, in main
renpy.game.script.report_duplicate_labels()
If I recall it correctly, the line number refers to where the script execution stopped, not exactly where the error is located.
https://www.renpy.org/doc/html/reserved ... rved-names

Re: [SOLVED] Try to load game but get "uncaught exception"

Posted: Mon Dec 02, 2019 7:35 pm
by willanik
Thanks for all the good ideas.

I reloaded my backup (aren’t they great when you need them!) and then progressively fed in the new lines.

That way I found the problem, in some lines I had copied from an earlier part of the game. In the earlier part when I wrote:

call mysteryscene

the implementation of the game turned the line into:

call mysteryscene from _call_mysteryscene_1

When I copied this whole line into the new text, the game saw the reference to _call_mysteryscene_1 as a duplication and that caused the exception. I deleted _call_mysteryscene_1 from the new line and the game now works again.

Thanks guys!

Re: Try to load game but get "uncaught exception"

Posted: Mon Dec 02, 2019 10:17 pm
by Donmai
Glad to know it's working now.