Object of type 'NoneType' has no len()

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
Nonohell
Newbie
Posts: 16
Joined: Wed Apr 11, 2018 2:30 pm
Contact:

Object of type 'NoneType' has no len()

#1 Post by Nonohell » Fri Jun 01, 2018 6:10 pm

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

User avatar
Alex
Lemma-Class Veteran
Posts: 2490
Joined: Fri Dec 11, 2009 5:25 pm
Contact:

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

#2 Post by Alex » Fri Jun 01, 2018 6:46 pm

Try to set default value for persistent.playername
https://www.renpy.org/doc/html/python.h ... -statement

User avatar
Taleweaver
Writing Maniac
Posts: 3428
Joined: Tue Nov 11, 2003 8:51 am
Completed: Metropolitan Blues, The Loyal Kinsman, Daemonophilia, The Dreaming, The Thirteenth Year, Adrift, Bionic Heart 2, Secrets of the Wolf, The Photographer
Projects: The Pilgrim's Path, Elspeth's Garden, Secret Adventure Game!
Organization: Tall Tales Productions
Location: Germany
Contact:

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

#3 Post by Taleweaver » Fri Jun 01, 2018 6:55 pm

Moved to Ren'Py Questions.
Scriptwriter and producer of Metropolitan Blues
Creator of The Loyal Kinsman
Scriptwriter and director of Daemonophilia
Scriptwriter and director of The Dreaming
Scriptwriter of Zenith Chronicles
Scriptwriter and director of The Thirteenth Year
Scriptwriter and director of Romance is Dead
Scriptwriter and producer of Adrift
More about me in my blog
"Adrift - Like Ever17, but without the Deus Ex Machina" - HigurashiKira

Nonohell
Newbie
Posts: 16
Joined: Wed Apr 11, 2018 2:30 pm
Contact:

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

#4 Post by Nonohell » Sat Jun 02, 2018 5:47 am

Yeah that work ! Thank tou so much Alex !

Post Reply

Who is online

Users browsing this forum: Alouette, Eliont, Google [Bot]