KeyError on a narration?

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
Rils
Newbie
Posts: 9
Joined: Sat Oct 22, 2016 11:20 pm
Contact:

KeyError on a narration?

#1 Post by Rils »

When I try to load the history now, this occurs.
It worked prior.

The only thing the KeyError seems to be related to is 2 pieces of dialogue that are only

Code: Select all

"\[Dating Start\]"
Traceback:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
  File "game/screens.rpy", line 918, in execute
    screen history():
  File "game/screens.rpy", line 918, in execute
    screen history():
  File "game/screens.rpy", line 925, in execute
    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport")):
  File "game/screens.rpy", line 443, in execute
    screen game_menu(title, scroll=None):
  File "game/screens.rpy", line 443, in execute
    screen game_menu(title, scroll=None):
  File "game/screens.rpy", line 453, in execute
    frame:
  File "game/screens.rpy", line 456, in execute
    hbox:
  File "game/screens.rpy", line 462, in execute
    frame:
  File "game/screens.rpy", line 465, in execute
    if scroll == "viewport":
  File "game/screens.rpy", line 479, in execute
    vpgrid:
  File "game/screens.rpy", line 489, in execute
    transclude
  File "game/screens.rpy", line 925, in execute
    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport")):
  File "game/screens.rpy", line 929, in execute
    for h in _history_list:
  File "game/screens.rpy", line 931, in execute
    window:
  File "game/screens.rpy", line 934, in execute
    has fixed:
  File "game/screens.rpy", line 947, in execute
    text h.what
KeyError: u'Dating Start'

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

Full traceback:
  File "renpy/common/00gamemenu.rpy", line 173, in script
    $ ui.interact()
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\ast.py", line 805, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\python.py", line 1641, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/00gamemenu.rpy", line 173, in <module>
    $ ui.interact()
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\ui.py", line 278, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\core.py", line 2496, in interact
    repeat, rv = self.interact_core(preloads=preloads, **kwargs)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\core.py", line 2764, in interact_core
    root_widget.visit_all(lambda i : i.per_interact())
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\core.py", line 464, in visit_all
    d.visit_all(callback)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\core.py", line 464, in visit_all
    d.visit_all(callback)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\core.py", line 464, in visit_all
    d.visit_all(callback)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\core.py", line 464, in visit_all
    d.visit_all(callback)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\screen.py", line 394, in visit_all
    callback(self)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\core.py", line 2764, in <lambda>
    root_widget.visit_all(lambda i : i.per_interact())
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\screen.py", line 404, in per_interact
    self.update()
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\display\screen.py", line 573, in update
    self.screen.function(**self.scope)
  File "game/screens.rpy", line 918, in execute
    screen history():
  File "game/screens.rpy", line 918, in execute
    screen history():
  File "game/screens.rpy", line 925, in execute
    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport")):
  File "game/screens.rpy", line 443, in execute
    screen game_menu(title, scroll=None):
  File "game/screens.rpy", line 443, in execute
    screen game_menu(title, scroll=None):
  File "game/screens.rpy", line 453, in execute
    frame:
  File "game/screens.rpy", line 456, in execute
    hbox:
  File "game/screens.rpy", line 462, in execute
    frame:
  File "game/screens.rpy", line 465, in execute
    if scroll == "viewport":
  File "game/screens.rpy", line 479, in execute
    vpgrid:
  File "game/screens.rpy", line 489, in execute
    transclude
  File "game/screens.rpy", line 925, in execute
    use game_menu(_("History"), scroll=("vpgrid" if gui.history_height else "viewport")):
  File "game/screens.rpy", line 929, in execute
    for h in _history_list:
  File "game/screens.rpy", line 931, in execute
    window:
  File "game/screens.rpy", line 934, in execute
    has fixed:
  File "game/screens.rpy", line 947, in execute
    text h.what
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\text\text.py", line 1335, in __init__
    self.set_text(text, scope, substitute)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\text\text.py", line 1410, in set_text
    i, did_sub = renpy.substitutions.substitute(i, scope, substitute)
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\substitutions.py", line 229, in substitute
    s = formatter.vformat(s, (), kwargs)
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 563, in vformat
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 585, in _vformat
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 646, in get_field
  File "/home/tom/ab/x64lucid-deps/install/lib/python2.7/string.py", line 605, in get_value
  File "D:\Renpy\renpy-6.99.10-sdk\renpy\substitutions.py", line 192, in __getitem__
    raise KeyError(key)
KeyError: u'Dating Start'

Windows-8-6.2.9200
Ren'Py 6.99.11.1749
Ahegao Academy 0.0.8

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: KeyError on a narration?

#2 Post by Divona »

There is no "\[" as Escape Characters. [ & ] only use to put variable in Text. I'm not sure what you're trying to do here. Remove \[ out from the text and it should fix it.

If you mean to use bracket in Text, use:

Code: Select all

u "[[Dating Start]]"
https://www.renpy.org/doc/html/text.htm ... characters
Completed:
Image

Rils
Newbie
Posts: 9
Joined: Sat Oct 22, 2016 11:20 pm
Contact:

Re: KeyError on a narration?

#3 Post by Rils »

That's weird, because it had no trouble at the time I put that text in, it's only until much later it caused this key error.

Edit: Well, that worked, huh.

Thanks!

Rils
Newbie
Posts: 9
Joined: Sat Oct 22, 2016 11:20 pm
Contact:

Re: KeyError on a narration?

#4 Post by Rils »

The Keyerror showed back up, if I do

Code: Select all

"[[Dating Start]]"
in the script it comes out as
[Dating Start]]
and if I do

Code: Select all

"[[Dating Start]"
I get the keyerror on History.

User avatar
Divona
Miko-Class Veteran
Posts: 678
Joined: Sun Jun 05, 2016 8:29 pm
Completed: The Falconers: Moonlight
Organization: Bionic Penguin
itch: bionicpenguin
Contact:

Re: KeyError on a narration?

#5 Post by Divona »

Hmm...doesn't seem like Ren'Py like you to use brackets in the text.

Go to "screen.rpy" and under "screen history():", change:

Code: Select all

text h.what
to

Code: Select all

text "[h.what]"
and keep using:

Code: Select all

"[[Dating Start]"
Completed:
Image

Post Reply

Who is online

Users browsing this forum: Bing [Bot], Google [Bot]