if args.nameheader is None: print("Error : Please input name header.") sys.exit(1) if args.directory is None: print("Error : Please input save path.") sys.exit(1) dir_path = args.directory[0] header = args.nameheader[0] # make a new directory if not os.path.exists(dir_path): os.makedirs(dir_path) # initialization dl = DLUtils() # choosing store path dir_root = os.getcwd() if dir_root == "": print("Error : Save path not found.") sys.exit(1) # initialization dl = DLUtils() # keywords for input_path in args.file: file_path = os.path.join(dir_root, input_path) if not os.path.exists(file_path): print("Error : File not exist.\n")
parser.add_argument("-l", "--limit", type=int, default=300, help="The number of downloding images (option)") parser.add_argument("--no-numbering", action="store_true", dest="nonum", default=False, help="download image without file-name numbering (option)") args = parser.parse_args() if args.keywords is None: parser.print_help() sys.exit(1) if args.dirname is None: parser.print_help() sys.exit(1) # initialization dl = DLUtils(api_info_path) # path check and choose save path if api_info_path == "": print("Error : Put API-info file in script path.") sys.exit(1) dir_root = "" for i in store_path: tmp = os.path.expanduser(i) if os.path.exists(tmp): dir_root = tmp break if dir_root == "": print("Error : Save path not found.")