[BUG - Develop] CmdSet.remove() does not take string args
See original GitHub issueDescribe the bug
Not sure if it’s a documentation error or a code error - this claims that you can pass it the key of a command to remove, but causes a traceback. https://github.com/evennia/evennia/blob/7f4769bd9d3403b8011998b0c903a490caa07be9/evennia/commands/cmdset.py#L566-L568
To Reproduce
Steps to reproduce the behavior:
- Attempt to remove a command from any CmdSet with the key, e.g.
self.remove("charcreate")
- The code gives a traceback because it cannot handle a string.
Expected behavior
Either it should remove the command in the set with that key or the docstring is inaccurate.
Develop-branch commit
7f4769bd9
Additional context
The traceback:
Traceback (most recent call last):
File ".../evennia/evennia/commands/cmdsethandler.py", line 208, in import_cmdset
cmdsetclass = cmdsetclass(cmdsetobj)
File ".../evennia/evennia/commands/cmdset.py", line 222, in __init__
self.at_cmdset_creation()
File "./accounts/commands.py", line 27, in at_cmdset_creation
self.remove("charcreate")
File ".../evennia/evennia/commands/cmdset.py", line 572, in remove
if cmd.key.startswith("__"):
AttributeError: 'str' object has no attribute 'key'
Issue Analytics
- State:
- Created a year ago
- Comments:8 (8 by maintainers)
Top Results From Across the Web
C++ STL remove error - string - Stack Overflow
The error he got was because there is another function that takes a single argument, called "remove", which deletes a file. Share.
Read more >Set - Environment Variable - Windows CMD - SS64.com
Display, set, or remove CMD environment variables. Changes made with SET will remain only for the duration of the current CMD session.
Read more >Add useful error messages when using list of arguments #1383
When having a list of arguments of a certain type, and the type conversion fails at one argument the TypeConversionException is converted to...
Read more >shell_exec - Manual - PHP
A string containing the output from the executed command, false if the pipe cannot be established or null if an error occurs or...
Read more >PyMOL Command Reference
USAGE drag [ selection ] ARGUMENTS selection = string: atoms to drag. If not provided, and dragging is active, then dragging is instead...
Read more >Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start FreeTop Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found
Top GitHub Comments
Hm. I think the docstring is correct; it’s consistent with the rest of the system to support removal both by cmd, key or even cmd-class-path. I don’t recall why this was never implemented, but most likely it’s because I mainly thought of
CmdsetHandler.remove
as being the main thing people would use. As it turns out,Cmdset.remove()
is a much more common use case than expected, since this is the easiest way to remove default commands.Looks like a code bug; everyone’s been using this with the command object 😃