My python script needs to read files from a directory passed on the command line. I have defined a readable_dir type as below to be used with argparse for validating that th
If your script can't work without a valid launch_directory then it should be made a mandatory argument:
launch_directory
parser.add_argument('launch_directory', type=readable_dir)
btw, you should use argparse.ArgumentTypeError instead of Exception in readable_dir().
argparse.ArgumentTypeError
Exception
readable_dir()