Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Invalid KeyError: 'method' #55

Open
nospotfer opened this issue Jan 8, 2021 · 0 comments
Open

Invalid KeyError: 'method' #55

nospotfer opened this issue Jan 8, 2021 · 0 comments

Comments

@nospotfer
Copy link

nospotfer commented Jan 8, 2021

Sometimes when running read_mrz on the back of a document with MRZ this error occours.
I'm happy to share any intermediate step or the ID that caused this if necessary!

Traceback:

mrz = read_mrz(im_bytes, True, pytesseract_config)
 File "/usr/local/lib/python3.8/site-packages/passporteye/mrz/image.py", line 355, in read_mrz
 mrz = p.result
File "/usr/local/lib/python3.8/site-packages/passporteye/mrz/image.py", line 343, in result
return self['mrz_final']
File "/usr/local/lib/python3.8/site-packages/passporteye/util/pipeline.py", line 102, in __getitem__
 self._compute(key)
File "/usr/local/lib/python3.8/site-packages/passporteye/util/pipeline.py", line 111, in _compute
results = self.components[cname](*inputs)
 File "/usr/local/lib/python3.8/site-packages/passporteye/mrz/image.py", line 319, in __call__
new_mrz.aux['method'] = new_mrz.aux['method'] + '\|max_width(%d)' % self.other_max_width
KeyError: 'method'

Context:
in passporteye/mrz/image.py in call at line 319

(...)
        if mrz is None and (__pipeline__['img_binary'].mean() < 0.01 or __pipeline__['img'].mean() > 0.95):
            __pipeline__.replace_component('scaler', Scaler(self.other_max_width))
            new_mrz = __pipeline__['mrz']
            if new_mrz is not None:
----->    new_mrz.aux['method'] = new_mrz.aux['method'] + '|max_width(%d)' % self.other_max_width
            mrz = new_mrz
        return mrz
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant