Handling import errors

Miki Tebeka miki.tebeka at gmail.com
Tue Jun 21 17:10:09 EDT 2011


> try:
>     import foo
> except ImportError:
>     logging.error('could not import foo')
>     sys.exit(1)
Why not just let the exception terminate the program? It will have even more information about the problem that caused foo not to load.



More information about the Python-list mailing list