handle not found exception
authorGui Chen <gui.chen@intel.com>
Thu, 6 Mar 2014 06:12:53 +0000 (01:12 -0500)
committerLihong Sun <lihongx.sun@intel.com>
Wed, 21 Jan 2015 09:12:43 +0000 (04:12 -0500)
Change-Id: Id4a3d99da61bac50be02bee1213d38ea70b4c4ec
Signed-off-by: Gui Chen <gui.chen@intel.com>
mic/rt_util.py

index 05a3fc8..3897efc 100644 (file)
@@ -156,13 +156,15 @@ def get_mic_binpath():
     fp = None
     try:
         import pkg_resources # depends on 'setuptools'
-    except ImportError:
-        pass
-    else:
         dist = pkg_resources.get_distribution('mic')
         # the real script is under EGG_INFO/scripts
         if dist.has_metadata('scripts/mic'):
             fp = os.path.join(dist.egg_info, "scripts/mic")
+    except ImportError:
+        pass
+    except pkg_resources.DistributionNotFound:
+        pass
+
 
     if fp:
         return fp