Check for action arg before use (fix Python 3 error)#79
Check for action arg before use (fix Python 3 error)#79cdbennett wants to merge 1 commit intopython-gitlab:masterfrom
Conversation
Check that the parsed `action` attribute exists before using it.
Previously, whenever the command-line tool was invoked on Python 3.4
without a bare-word argument, which is expected to be the action, the
program aborts with an AttributeError in cli.py on the line assigning
`arg.action` to `action`:
AttributeError: 'Namespace' object has no attribute 'action'
|
Could you give an example of a command that would generate this error? Thanks. |
|
This issue occurs whenever there is no positional ("bareword") argument given to the program. For instance, with no arguments at all It will also occur if you provide option arguments, but still don't provide a positional argument (one that is not an option flag) as in This test was performed with the #78 ( |
|
I just push commit 7c38ef6 which should fix for this bug. It uses the argparse features instead of providing a custom test. Could you test it to make sure it behaves as you would expect? Thanks. |
|
Verified fixed with commit 7c38ef6. Thanks. |
Check that the parsed
actionattribute exists before using it.Previously, whenever the command-line tool was invoked on Python 3.4
without a bare-word argument, which is expected to be the action, the
program aborts with an AttributeError in cli.py on the line assigning
arg.actiontoaction: