MRZ image not working on python code

import ocrspace
api = ocrspace.API()
api = ocrspace.API(‘here_is_my_key’, ocrspace.Language.English)

print(api.ocr_file(‘rotated_rois/roi_0.jpg’))

In my test it fails with OCR Engine 1, but it works fine with OCR Engine type 2:

Result:

****** Result for Image/Page 1 ******
PEGYHASSAN<<AHMED<ALI<YOUSE F<<<<<<<<<<<<<<<
A207614002 EGY9002269M2407186<<<<<<<<<<<<<<04

See also MRZ reading in passports - #4 by admin

Hi

There are some errors

In first line missing a < in the second line there is a space not in original image.

can you help me how to use ocr engine 2 in python code?

Engine 2 uses exactly the same format, just add the OCREngine=2 parameter.

api = ocrspace.API(‘api_key’, ocrspace.Language.English, OCREngine=2)

is this correct?
because it is not working.