Skip to content

Commit 6a7e2f3

Browse files
committed
Fixed P2PDistance
Interface failed because tvtk is loaded with the default value of ETSConfig.toolkit. Now it is initialized, so now the enthough.traitsui does not look for $DISPLAY.
1 parent cba8e41 commit 6a7e2f3

File tree

1 file changed

+10
-1
lines changed

1 file changed

+10
-1
lines changed

nipype/algorithms/mesh.py

Lines changed: 10 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,16 @@ def _triangle_area(self, A, B, C):
6464
return area
6565

6666
def _run_interface(self, runtime):
67-
from tvtk.api import tvtk
67+
try:
68+
from enthought.etsconfig.api import ETSConfig
69+
ETSConfig.toolkit = 'null'
70+
except:
71+
raise RuntimeError('P2PDistance could not access ETSConfig')
72+
try:
73+
from tvtk.api import tvtk
74+
except ImportError:
75+
raise ImportError('Interface P2PDistance requires tvtk')
76+
6877
r1 = tvtk.PolyDataReader( file_name=self.inputs.surface1 )
6978
r2 = tvtk.PolyDataReader( file_name=self.inputs.surface2 )
7079
vtk1 = r1.output

0 commit comments

Comments
 (0)