GSTT-CSC / project-template

Template for new projects
0 stars 0 forks source link

argparse argument can't have 'type' and "action='store_true'" #8

Open hshuaib90 opened 3 years ago

hshuaib90 commented 3 years ago

When running:

python run_project.py --help

I get the error:

Traceback (most recent call last):
  File "run_project.py", line 21, in <module>
    help='use localhost flag')
  File "/Library/Frameworks/Python.framework/Versions/3.7/lib/python3.7/argparse.py", line 1353, in add_argument
    action = action_class(**kwargs)
TypeError: __init__() got an unexpected keyword argument 'type'

Looking at the accepted answer on StackOverflow here: https://stackoverflow.com/a/33574480 (and the comment underneath) it seems that the documentation for argparse is misleading and you can't in fact have store_true and type in the same arg.

Deleting type for the -largument seems to work.