A cleaner way to handle import failures |
|||
Issue description
In Autotest code, we use a lot of
try:
import x
except ImportError:
do sth else
A cleaner way could be
Use importlib.import_module to write a utils function
metrics = utils.safe_import('metrics', 'chromite.lib')
Proposed in this review:
https://chromium-review.googlesource.com/#/c/438754/2..3/scheduler/host_scheduler.py
,
Feb 15 2018
This issue has been Available for over a year. If it's no longer important or seems unlikely to be fixed, please consider closing it out. If it is important, please re-triage the issue. Sorry for the inconvenience if the bug really should have been left as Available. If you change it back, also remove the "Hotlist-Recharge-Cold" label. For more details visit https://www.chromium.org/issue-tracking/autotriage - Your friendly Sheriffbot
,
May 16 2018
|
|||
►
Sign in to add a comment |
|||
Comment 1 by aut...@google.com
, Feb 15 2017