Skip to content

Tag: argparse

‘Namespace’ object is not iterable

Attempting to pass an undetermined amount of integers using argparse. When I input: py main.py 3 2 Error Namespace Argument is not iterable I think is is because I am passing an argument that is not of the correct type. After reading through all the documentation I could find I cannot figure out how to make t…

Automation of tasks with argparse Python3

Hi is anyone able to help. I am learning to use argparse and i want to use the command to call the school.py as school start for example. I have this so far but struggling to handle the arguments. Am i doing this right or what am i doing totally wrong? My error is autoSchoolDay.py: error: the following argume…

How to take infinite number of arguments in argparse?

I am making a Python command line tool with argparse that decodes and encodes Morse code. Here is the code: when I type more that one argument after encode or decode it returns this: How will I take more arguments and not just the first word? Answer The shell splits the input into separate strings on space, s…