New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Workflows should print out help per default #1674

Closed
arokem opened this Issue Nov 29, 2018 · 1 comment

Comments

Projects
None yet
2 participants
@arokem
Copy link
Member

arokem commented Nov 29, 2018

For example, when you type:

dipy_fit_dti

It would be much better if you got the help documentation than the current:

(dipy) code (master)$dipy_fit_dti 
Too few arguments: Program dipy_fit_dti expects arguments.

Type dipy_fit_dti -h for help.

Traceback (most recent call last):
  File "/Users/arokem/.virtualenvs/dipy/bin/dipy_fit_dti", line 7, in <module>
    exec(compile(f.read(), __file__, 'exec'))
  File "/Users/arokem/source/dipy/bin/dipy_fit_dti", line 9, in <module>
    run_flow(ReconstDtiFlow())
  File "/Users/arokem/source/dipy/dipy/workflows/flow_runner.py", line 57, in run_flow
    args = parser.get_flow_args()
  File "/Users/arokem/source/dipy/dipy/workflows/base.py", line 275, in get_flow_args
    ns_args = self.parse_args(args, namespace)
  File "/Users/arokem/source/dipy/dipy/fixes/argparse.py", line 1667, in parse_args
    args, argv = self.parse_known_args(args, namespace)
  File "/Users/arokem/source/dipy/dipy/fixes/argparse.py", line 1699, in parse_known_args
    return self._parse_known_args(args, namespace)
  File "/Users/arokem/source/dipy/dipy/fixes/argparse.py", line 1917, in _parse_known_args
    self.error(_('too few arguments'))
UnboundLocalError: local variable '_' referenced before assignment

Which does include the instruction to use the -h flag, but is buried inside of a stack that is not super informative. Does anyone know how to make -h the default behavior in the absence of any other inputs?

@skoudoro

This comment has been minimized.

Copy link
Member

skoudoro commented Nov 29, 2018

I agree, thanks for this feedback. I just know that you need to call IntrospectiveArgumentParser.print_help() on flow_runner.py file but I do not know how to avoid the Traceback yet. We need to look deeper into it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment