RustyShackleford
RustyShackleford

Reputation: 3667

How to pass filepath properly into argparser for tesseract?

I am following this guide to do image analysis.

In the first block of code (lines 9-14) there is an option to input file path to the image. When I input my file and run lines 9-14 I keep getting the following error:

 SystemExit: 2

    usage:  [-h] -Users/bob/Desktop/image.png IMAGE
            [-p PREPROCESS]
    : error: argument -Users/bob/Desktop/image.png/--image is required

This is how I inputted my file path in line 10 of the guide.

ap = argparse.ArgumentParser()
ap.add_argument("-i", "--Users/bob/Desktop/image.png", required=True,
    help="path to input image to be OCR'd")
ap.add_argument("-p", "--preprocess", type=str, default="thresh",
    help="type of preprocessing to be done")
args = vars(ap.parse_args())

I am not sure what I am doing wrong with the file path to get this error.

Upvotes: 0

Views: 472

Answers (1)

kristaps
kristaps

Reputation: 1723

Appears to be a copy/paste mishap - the tutorial has "--image" while your snippet shows "--Users/bob/Desktop/image.png", which looks like pasted text accidentally landing at the wrong place.

Upvotes: 2

Related Questions