Did I bork inventory?

39 views
Skip to first unread message

Quilnux

unread,
Feb 9, 2021, 9:56:43 PM2/9/21
to Evennia
Last night I had a player that told me their inventory gives them an error. I was able to reproduce it with my account, including the DM account. Did I mess something up perhaps?

Traceback (most recent call last):
  File "c:\program files\python\python39\Lib\site-packages\evennia\commands\cmdhandler.py", line
644, in _run_command
    ret = cmd.func()
  File "c:\program files\python\python39\Lib\site-packages\evennia\commands\default\general.py",
line 387, in func
    "{}".format(utils.crop(raw_ansi(item.db.desc), width=50) or ""),
  File "c:\program files\python\python39\Lib\site-packages\evennia\utils\ansi.py", line 526, in raw
    return string.replace("{", "{").replace("|", "|")
AttributeError: 'NoneType' object has no attribute 'replace'

An untrapped error occurred.

Quilnux

unread,
Feb 9, 2021, 9:59:55 PM2/9/21
to Evennia
(pressing enter seems unwise in groups and it posted the message before I was ready)

[Continued]

I was easily able to fix it by examining the player and removing everything from their inventory but I was wondering why this happened in the first place. I've been creating objects in DM so it doesn't surprise me there but why would a player experience this?

Kovitikus

unread,
Feb 9, 2021, 10:03:34 PM2/9/21
to Evennia
I think that wherever it is breaking, it's not a string. It's trying to do .replace on something that isn't the type of object it is expecting, the string object. That's my best guess at least. I don't know specifically where in your project this is broken.

Zude Onim

unread,
Feb 9, 2021, 10:42:20 PM2/9/21
to eve...@googlegroups.com
Have you changed the default 'inventory' command at all ?
> --
> You received this message because you are subscribed to the Google Groups
> "Evennia" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to evennia+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/evennia/79487505-12a1-4a6a-ae37-2446375a53d0n%40googlegroups.com.
>

Quilnux

unread,
Feb 9, 2021, 11:24:57 PM2/9/21
to Evennia
Sadly no, otherwise I would totally understand this and I'd be looking for a way to resolve it. I did some more testing since I posted this and it looks like there are only 2 items that cause this. If the account/character logs out and there is a server restart, it happens. Any chance this can happen for objects that were not created with a Persistant=true?

Quilnux

unread,
Feb 10, 2021, 12:03:44 AM2/10/21
to Evennia
Here's a copy of the code that creates the object that goes to the player (caller)

from evennia import DefaultObject
from evennia.utils import create

[... class stuff... blah blahh]

item = create.create_object("typeclasses.objects.Object","Tankard of Ale")
item.move_to(caller)

Does this help? I also found out it seems to happen even if the character is not logged out.

Zude Onim

unread,
Feb 10, 2021, 12:06:30 AM2/10/21
to eve...@googlegroups.com
> [... class stuff... blah blahh]

Let's see this, too. It might help.

Quilnux

unread,
Feb 10, 2021, 12:09:27 AM2/10/21
to Evennia
[from file: menu_BarMenuStarter.py]

from evennia import Command
from evennia.utils.evmenu import EvMenu

class CmdBarMenu(Command):

key = "Menu"
aliases = ("Food", "Drinks")

def func(self):
"Shows the menu for buying food and drinks"
EvMenu(self.caller, "commands.menus.menu_BarMenuModule", startnode="node1")

---

[from file: menu_BarMenuModule.py]

from evennia.utils.evmenu import EvMenu
from evennia import DefaultObject
from evennia.utils import create
    
def node1(caller, obj):
# (this is the start node if called like above)
# code

text = ("The Long Road Inn Food and Drink Menu", "There is no help text for this menu")
options = ({"desc": "Ale", "goto": "get_ale"},{"desc": "Mead", "goto": "get_Mead"})
return text, options

def get_ale(caller, obj):
item = create.create_object("typeclasses.objects.Object","Tankard of Ale")
item.move_to(caller)
return None

def get_Mead(caller, obj):
item = create.create_object("typeclasses.objects.Object","Tankard of Mead")
item.move_to(caller)
return None

Quilnux

unread,
Feb 10, 2021, 12:17:39 AM2/10/21
to Evennia
I'm dumb... no no, seriously.. I'm a complete idiot... Just realized that in the script I never set the desc attribute... After applying the desc on the object, it works just fine...

Zude Onim

unread,
Feb 10, 2021, 1:18:18 AM2/10/21
to eve...@googlegroups.com
OK !

Well that was a nice little adventure.
> --
> You received this message because you are subscribed to the Google Groups
> "Evennia" group.
> To unsubscribe from this group and stop receiving emails from it, send an
> email to evennia+u...@googlegroups.com.
> To view this discussion on the web visit
> https://groups.google.com/d/msgid/evennia/4c0a13dc-2136-4fbb-9b20-325278635cefn%40googlegroups.com.
>
Reply all
Reply to author
Forward
0 new messages