From 205a6ef01ac7737d55f550947c9421df69904cb6 Mon Sep 17 00:00:00 2001 From: moeb Date: Fri, 15 May 2015 13:12:40 +0200 Subject: [PATCH] a little improvement to https://github.com/dcowden/cadquery/pull/87 --- cadquery/freecad_impl/__init__.py | 13 ++++++++++--- 1 file changed, 10 insertions(+), 3 deletions(-) diff --git a/cadquery/freecad_impl/__init__.py b/cadquery/freecad_impl/__init__.py index 46d6c64..338bcea 100644 --- a/cadquery/freecad_impl/__init__.py +++ b/cadquery/freecad_impl/__init__.py @@ -96,10 +96,17 @@ def _fc_path(): return _PATH + +#Make sure that the correct FreeCAD path shows up in Python's system path +no_library_path = ImportError('cadquery was unable to determine freecads library path') try: import FreeCAD except ImportError: - #Make sure that the correct FreeCAD path shows up in Python's system path path = _fc_path() - if path: sys.path.insert(0, _fc_path()) - else: raise ImportError('cadquery was unable to determine freecads library path') + if path: + sys.path.insert(0, _fc_path()) + try: + import FreeCAD + except ImportError: + raise no_library_path + else: raise no_library_path