Opened 9 years ago

Closed 9 years ago

#490 closed defect (fixed)

Alias with missing argument gives cryptic error

Reported by: meng@… Owned by: Greg Couch
Priority: major Milestone:
Component: Command Line Version:
Keywords: Cc:
Blocked By: Blocking:
Notify when closed: Platform: all
Project: ChimeraX

Description

Using an alias without an argument gives a cryptic error message. It should be a UserError saying "Missing argument to alias 'snap'".

alias snap save $1.png

snap

Traceback (most recent call last):
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 2068, in _process_positional_arguments
value, text = self._parse_arg(anno, text, session, False)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 1915, in _parse_arg
value, replacement, rest = annotation.parse(text, session)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 646, in parse
raise AnnotationError("Expected %s" % StringArg.name)
chimerax.core.commands.cli.AnnotationError: Expected a text string

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/cmd_line/tool.py", line 148, in execute
cmd.run(cmd_text)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 2213, in run
prev_annos = self._process_positional_arguments()
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 2084, in _process_positional_arguments
_user_kw(kw_name), err)
File "/Users/goddard/ucsf/chimerax/ChimeraX.app/Contents/Library/Frameworks/Python.framework/Versions/3.5/lib/python3.5/site-packages/chimerax/core/commands/cli.py", line 318, in _user_kw
words = kw_name.split('_')
AttributeError: 'int' object has no attribute 'split'

Change History (1)

comment:1 by Greg Couch, 9 years ago

Resolution: fixed
Status: newclosed

Fixed error message.

Note: See TracTickets for help on using tickets.