Try to load game but get "uncaught exception"

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
willanik
Regular
Posts: 26
Joined: Fri Mar 24, 2017 7:44 pm
Contact:

Try to load game but get "uncaught exception"

#1 Post by willanik » 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

-- 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.

User avatar
Per K Grok
Miko-Class Veteran
Posts: 823
Joined: Fri May 18, 2018 1:02 am
Completed: the Ghost Pilot, Sea of Lost Ships, Bubbles and the Pterodactyls, Defenders of Adacan Part 1 & 2, the Phantom Flyer
itch: per-k-grok
Location: Sverige
Contact:

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

#2 Post by Per K Grok » Wed Nov 27, 2019 2:42 am

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?

User avatar
Donmai
Eileen-Class Veteran
Posts: 1913
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question
Projects: Slumberland
Location: Brazil
Contact:

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

#3 Post by Donmai » Wed Nov 27, 2019 10:56 am

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.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

willanik
Regular
Posts: 26
Joined: Fri Mar 24, 2017 7:44 pm
Contact:

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

#4 Post by willanik » Thu Nov 28, 2019 7:30 pm

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.

User avatar
Remix
Eileen-Class Veteran
Posts: 1592
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: Try to load game but get "uncaught exception"

#5 Post by Remix » Thu Nov 28, 2019 9:33 pm

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...
Frameworks & Scriptlets:

User avatar
Donmai
Eileen-Class Veteran
Posts: 1913
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question
Projects: Slumberland
Location: Brazil
Contact:

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

#6 Post by Donmai » Sat Nov 30, 2019 9:08 am

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
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

willanik
Regular
Posts: 26
Joined: Fri Mar 24, 2017 7:44 pm
Contact:

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

#7 Post by willanik » Mon Dec 02, 2019 7:35 pm

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!

User avatar
Donmai
Eileen-Class Veteran
Posts: 1913
Joined: Sun Jun 10, 2012 1:45 am
Completed: Toire No Hanako, Li'l Red [NaNoRenO 2013], The One in LOVE [NaNoRenO 2014], Running Blade [NaNoRenO 2016], The Other Question
Projects: Slumberland
Location: Brazil
Contact:

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

#8 Post by Donmai » Mon Dec 02, 2019 10:17 pm

Glad to know it's working now.
Image
No, sorry! You must be mistaking me for someone else.
TOIRE NO HANAKO (A Story About Fear)

Post Reply

Who is online

Users browsing this forum: Ocelot