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

Popular posts from this blog

1111. appearing after print sequence - php -

java - WARN : org.springframework.web.servlet.PageNotFound - No mapping found for HTTP request with URI [/board/] in DispatcherServlet with name 'appServlet' -

Ruby on Rails, ActiveRecord, Postgres, UTF-8 and ASCII-8BIT encodings -