Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

parser.add_argument: error: unrecognized arguments: True

I have a program in python 2.7, which has a line of code:

parser.add_argument('--skip_train', default=False, help='skip training', action='store_true')

This code tells the program to run with training by default. But now I want to implement it without training since the training has been done. So I type in the prompt:

python myprogame.py --skip_train True

But this gives an error message:

error: unrecognized arguments: True

What should type in the prompt command to implement the program?

like image 258
jingweimo Avatar asked Feb 14 '26 20:02

jingweimo


1 Answers

When you use action='store_true', you shouldn't provide a value for the --skip_train option. Just do:

python myprogame.py --skip_train
like image 166
Alasdair Avatar answered Feb 17 '26 12:02

Alasdair



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!