Skip to content

Commit d2183a1

Browse files
committed
More specific error handling
1 parent 73bb431 commit d2183a1

File tree

1 file changed

+12
-5
lines changed

1 file changed

+12
-5
lines changed

nipype/algorithms/mesh.py

Lines changed: 12 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,23 @@ def _triangle_area(self, A, B, C):
6767
return area
6868

6969
def _run_interface(self, runtime):
70-
try:
71-
from enthought.etsconfig.api import ETSConfig
72-
ETSConfig.toolkit = 'null'
73-
except:
74-
raise RuntimeError('P2PDistance could not access ETSConfig')
7570
try:
7671
from tvtk.api import tvtk
7772
except ImportError:
7873
raise ImportError('Interface P2PDistance requires tvtk')
7974

75+
try:
76+
from enthought.etsconfig.api import ETSConfig
77+
except ImportError:
78+
iflogger.warn(('ETS toolkit could not be imported'))
79+
else:
80+
try:
81+
ETSConfig.toolkit = 'null'
82+
except:
83+
iflogger.warn(('ETS toolkit could not be set to \'null\' '
84+
'for headless operation'))
85+
pass
86+
8087
r1 = tvtk.PolyDataReader(file_name=self.inputs.surface1)
8188
r2 = tvtk.PolyDataReader(file_name=self.inputs.surface2)
8289
vtk1 = r1.output

0 commit comments

Comments
 (0)