Page 1 of 1

Object of type 'NoneType' has no len()

Posted: Fri Jun 01, 2018 6:10 pm
by Nonohell
Hi !
I recently got this error when i delete my persistent and now when i click to the start button i got this error message:

Code: Select all

I'm sorry, but an uncaught exception occurred.

While running game code:
TypeError: object of type 'NoneType' has no len()

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

Full traceback:
  File "renpy/common/_layout/screen_main_menu.rpym", line 28, in script
    python hide:
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\ast.py", line 848, in execute
    renpy.python.py_exec_bytecode(self.code.bytecode, self.hide, store=self.store)
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\python.py", line 1812, in py_exec_bytecode
    exec bytecode in globals, locals
  File "renpy/common/_layout/screen_main_menu.rpym", line 35, in <module>
    ui.interact()
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\ui.py", line 287, in interact
    rv = renpy.game.interface.interact(roll_forward=roll_forward, **kwargs)
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\display\core.py", line 2624, in interact
    repeat, rv = self.interact_core(preloads=preloads, trans_pause=trans_pause, **kwargs)
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\display\core.py", line 3000, in interact_core
    renpy.display.behavior.input_post_per_interact()
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\display\behavior.py", line 1040, in input_post_per_interact
    i.update_text(content, editable)
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\display\behavior.py", line 1177, in update_text
    set_content(new_content)
  File "C:\Users\boulanger\Downloads\renpy-6.99.14.1-sdk\renpy\display\behavior.py", line 1171, in set_content
    l = len(content)
TypeError: object of type 'NoneType' has no len()

Windows-8-6.2.9200
Ren'Py 6.99.14.1.3218
Test
Fri Jun 01 23:16:51 2018
I think the error come from this part of code cause when i delete it the game start normally:

Code: Select all

textbutton _("Nouvelle partie") action If(persistent.playername, true=Start(), false=Show(screen="name_input", message="Veuillez entrer votre nom", confirm_action=Function(FinishEnterName)))

init -501 screen name_input(message, confirm_action):


    modal True

    zorder 200

    style_prefix "confirm"

    add "gui/overlay/confirm.png"
    key "K_RETURN" action [Play("sound", gui.activate_sound), confirm_action]

    frame:

        has vbox:
            xalign .5
            yalign .5
            spacing 30

        label _(message):
            style "confirm_prompt"
            xalign 0.5

        input default "" value VariableInputValue("player") length 15 allow "ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz"
    





        hbox:
            xalign 0.5
            spacing 100

            textbutton _("confirmer") action confirm_action
Thank you for help !!

Re: Object of type 'NoneType' has no len()

Posted: Fri Jun 01, 2018 6:46 pm
by Alex
Try to set default value for persistent.playername
https://www.renpy.org/doc/html/python.h ... -statement

Re: Object of type 'NoneType' has no len()

Posted: Fri Jun 01, 2018 6:55 pm
by Taleweaver
Moved to Ren'Py Questions.

Re: Object of type 'NoneType' has no len()

Posted: Sat Jun 02, 2018 5:47 am
by Nonohell
Yeah that work ! Thank tou so much Alex !