mirror of
https://github.com/IfcOpenShell/IfcOpenShell.git
synced 2026-09-27 02:31:09 +00:00
Change exception on failed import for Python 2 compatibility
This commit is contained in:
committed by
Thomas Krijnen
parent
8d4f34461e
commit
f84982f99a
@@ -33,13 +33,13 @@ def has_occ():
|
|||||||
try:
|
try:
|
||||||
import OCC.Core.BRepTools
|
import OCC.Core.BRepTools
|
||||||
return True
|
return True
|
||||||
except ModuleNotFoundError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
try:
|
try:
|
||||||
import OCC.BRepTools
|
import OCC.BRepTools
|
||||||
return True
|
return True
|
||||||
except ModuleNotFoundError:
|
except ImportError:
|
||||||
pass
|
pass
|
||||||
|
|
||||||
return False
|
return False
|
||||||
@@ -57,7 +57,7 @@ if has_occ:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from OCC.Core import TopoDS
|
from OCC.Core import TopoDS
|
||||||
except ModuleNotFoundError:
|
except ImportError:
|
||||||
from OCC import TopoDS
|
from OCC import TopoDS
|
||||||
|
|
||||||
def wrap_shape_creation(settings, shape): return utils.create_shape_from_serialization(shape) if getattr(settings,
|
def wrap_shape_creation(settings, shape): return utils.create_shape_from_serialization(shape) if getattr(settings,
|
||||||
|
|||||||
@@ -29,7 +29,7 @@ from collections import namedtuple, Iterable
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
from OCC.Core import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d
|
from OCC.Core import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d
|
||||||
except ModuleNotFoundError:
|
except ImportError:
|
||||||
from OCC import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d
|
from OCC import V3d, TopoDS, gp, AIS, Quantity, BRepTools, Graphic3d
|
||||||
|
|
||||||
shape_tuple = namedtuple('shape_tuple', ('data', 'geometry', 'styles'))
|
shape_tuple = namedtuple('shape_tuple', ('data', 'geometry', 'styles'))
|
||||||
|
|||||||
Reference in New Issue
Block a user