faustomorales / keras-ocr

A packaged and flexible version of the CRAFT text detector and Keras CRNN recognition model.
https://keras-ocr.readthedocs.io/
MIT License
1.38k stars 355 forks source link

Added explicit exception when reading #139

Closed moctarjallo closed 3 years ago

moctarjallo commented 3 years ago

The error is not understood otherwise and user is forced to look inside code to find what is going on. Instead this is the displayed error: "UnboundLocalError: local variable 'image' referenced before assignment" because none of the conditions in if-statements where true so 'image' variable wouldn't have been defined hence this error, which is misleading since the real error resides at the input that shouldn't make the 'read' operation fail: raise an Exception that clearly shows that.

faustomorales commented 3 years ago

Closing due to inactivity.