mnmelo/lazy_import

Can I catch an ImportError exception?

Closed this issue · 1 comments

Even if I place try/except around the lazy statements or the lazy_callable routine -- I can't catch the errors and I get: the standard: ImportError: XXX attempted to use a functionality that requires model aaa, but it couldn't be loaded.

I'd like to have my main routine still run if the lazy loading fails.

Maybe it's because my main routine is within a Flask app. Hmm, maybe I should post a stacktrace..

For Flask, I had to start my app with use_reloader=False in order to catch the exception. So this was not a lazy_import "bug"