python - TypeError: __init__() got an unexpected keyword argument 'type' (argparse issue?) -
i'm trying write simple script using python3 , error when attempting force arg value string. i've searched around other threads largely involve using django, etc, not i'm trying do.
any appreciated! in advance.
import argparse parser = argparse.argumentparser('seq_file', type=str, = 'xyz') parser.add_argument('sequence_file', type=str, help='xyz') args = parser.parse_args() the error i'm getting is:
file "x.py", line y, in <module> parser = argparse.argumentparser('seq_file', type=str, help='xyz') typeerror: __init__() got unexpected keyword argument 'type' what doing wrong?
the docs show argparse.argumentparser not take type argument.
it looks trying describe argument in constructor argumentparser. use add_argument method that.
change
parser = argparse.argumentparser('seq_file', type=str, = 'xyz') to
parser = argparse.argumentparser() parser.add_argument('seq_file', type=str, help='xyz')
Comments
Post a Comment