question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

`@spawn` traceback within evennia.prototypes.prototypes.protfunc_parser

See original GitHub issue

Brief summary of issue / Description of requested feature:

Based on https://github.com/evennia/evennia/wiki/evennia.prototypes.protfuncs, it seems like all protofuncs are preceeded by $ character. However, prototype values without preceding $ are getting treated as $protofunc.

Steps to reproduce the issue / Reasons for adding feature:

  1. @spawn {'key':'stone(#1234)'}

Error output / Expected result of feature

18-10-24 01:46:49 [::] Traceback (most recent call last):
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/commands/cmdhandler.py", line 594, in _run_command
18-10-24 01:46:49 [::]     _progressive_cmd_run(cmd, ret)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/commands/cmdhandler.py", line 193, in _progressive_cmd_run
18-10-24 01:46:49 [::]     value = generator.next()
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/commands/default/building.py", line 3098, in func
18-10-24 01:46:49 [::]     for obj in spawner.spawn(prototype):
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/prototypes/spawner.py", line 694, in spawn
18-10-24 01:46:49 [::]     create_kwargs["db_key"] = init_spawn_value(val, str)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/prototypes/prototypes.py", line 735, in init_spawn_value
18-10-24 01:46:49 [::]     value = protfunc_parser(value)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/prototypes/prototypes.py", line 583, in protfunc_parser
18-10-24 01:46:49 [::]     stacktrace=stacktrace, testing=testing, **kwargs)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/utils/inlinefuncs.py", line 425, in parse_inlinefunc
18-10-24 01:46:49 [::]     retval = "".join(_run_stack(item) for item in stack)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/utils/inlinefuncs.py", line 425, in <genexpr>
18-10-24 01:46:49 [::]     retval = "".join(_run_stack(item) for item in stack)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/utils/inlinefuncs.py", line 423, in _run_stack
18-10-24 01:46:49 [::]     retval = "" if strip else func(*args, **kwargs)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/prototypes/protfuncs.py", line 315, in obj
18-10-24 01:46:49 [::]     obj = _obj_search(return_list=False, *args, **kwargs)
18-10-24 01:46:49 [::]   File "/usr/src/evennia/evennia/prototypes/protfuncs.py", line 295, in _obj_search
18-10-24 01:46:49 [::]     raise ValueError("$obj: Query '{}' gave no matches.".format(query))
18-10-24 01:46:49 [::] ValueError: $obj: Query '#1234' gave no matches.
18-10-24 01:46:49 [EE] User input was: '@spawn {'key':'stone(#1234)'}'.

Extra information, such as Evennia revision/repo/branch, operating system and ideas for how to solve / implement:

It seems like the parsing and its regular expression is incorrect?

Code lifted from evennia.prototypes.prototypes.protfunc_parser

import re
_RE_DBREF = re.compile(r"(?<!\$obj\()(#[0-9]+)")
v = 'stone(#1234)'
_RE_DBREF.sub('$obj(\\1)', v)
'stone($obj(#1234))'

Issue Analytics

  • State:closed
  • Created 5 years ago
  • Comments:14 (14 by maintainers)

github_iconTop GitHub Comments

1reaction
Griatchcommented, Oct 28, 2018

The $obj protfunc is more general since it allows you to free-form search for an object by key, alias or dbref. Having a separate $dbref() only for dbrefs could be pretty intuitive though, I agree.

The wiki is normally edited in-place, in the web interface. Usually no permission is needed. If you have some big change and are unsure about it you can always ask about it in IRC/Discord.

0reactions
Griatchcommented, Oct 28, 2018

Sounds good 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Spawner and Prototypes — Evennia 1.0-dev documentation
The spawner is a system for defining and creating individual objects from a base template called a prototype. It is only designed for...
Read more >
evennia.prototypes.prototypes · evennia/evennia Wiki
Helper function to check access to actions on given prototype. Args: prototype_key (str): The prototype to affect. action (str): One of "spawn" ...
Read more >
Python Multiprocessing Traceback (most recent call last)
_name) File "C:\Users\Goal\AppData\Local\Programs\Python\Python39\lib\multiprocessing\spawn.py", line 154, in get_preparation_data File ...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found