Please find below the code i wrote (based on the assignment) and the error message i got back. I m new to python so i apologize in advance if this is super obvious.
def get_input_args():
"""
Retrieves and parses the 3 command line arguments provided by the user when
they run the program from a terminal window. This function uses Python's
argparse module to created and defined these 3 command line arguments. If
the user fails to provide some or all of the 3 arguments, then the default
values are used for the missing arguments.
Command Line Arguments:
1. Image Folder as --dir with default value 'pet_images'
2. CNN Model Architecture as --arch with default value 'vgg'
3. Text File with Dog Names as --dogfile with default value 'dognames.txt'
This function returns these arguments as an ArgumentParser object.
Parameters:
None - simply using argparse module to create & store command line arguments
Returns:
parse_args() -data structure that stores the command line arguments object
"""
parser = argparse.ArgumentParser()
parser.add_argument('--dir', type = str, default = 'pet_images/', help = 'path to the folder of pet images')
parser.add_argument('--arch', type = str, default = 'vgg', help = 'CNN model Architecture VGG')
parser.add_argument('--dogfile', type = str, default = 'dognames.txt', help = 'Text File with Dog Names')
# Replace None with parser.parse_args() parsed argument collection that
# you created with this function**
args = parser.parse_args('--dir', '--arch', '--dogfile')
root@791d23aa2615:/home/workspace# python check_images.py
Traceback (most recent call last):
File "check_images.py", line 131, in <module>
main()
File "check_images.py", line 51, in main
in_arg = get_input_args()
File "/home/workspace/get_input_args.py", line 49, in get_input_args
args = parser.parse_args('--dir', '--arch', '--dogfile')
TypeError: parse_args() takes from 1 to 3 positional arguments but 4 were given
thank you
After Charles answer I used
args = parser.parse_args()
But I cannot get the default values as I should
* Doesn't Check the Command Line Arguments because 'get_input_args' hasn't been defined.
* Doesn't Check the Results Dictionary because 'get_pet_labels' hasn't been defined.
* Doesn't Check the Results Dictionary because 'classify_images' hasn't been defined.
* Doesn't Check the Results Dictionary because 'adjust_results4_isadog' hasn't been defined.
* Doesn't Check the Results Dictionary because 'calculates_results_stats' hasn't been defined.
** Total Elapsed Runtime: 0:0:10