Skip to content Skip to sidebar Skip to footer

How To Use Argument Parse In Google Colabs

The Following Code of mine produces some error import argparse ap = argparse.ArgumentParser() args = ap.parse_args() But Even Without adding any argument it still produces below e

Solution 1:

If you want this code to run on Google Collab with no error, you should add an additionnal argument option to your ArgumentParser:

from imutils.video import VideoStream 
from imutils.video import FPS 
import argparse 
import imutils 
import time 
import cv2 

ap = argparse.ArgumentParser() 
ap.add_argument("-v", "--video", type=str,help="path to input video file",) 
ap.add_argument("-t", "--tracker", required=False,type=str, default="kcf", help="OpenCV object tracker type") 
ap.add_argument("-f", "--file", required=False) 

args = vars(ap.parse_args())

Post a Comment for "How To Use Argument Parse In Google Colabs"