@@ -1722,8 +1722,12 @@ class WarpPoints(CommandLine):
1722
1722
1723
1723
def __init__ (self , command = None , ** inputs ):
1724
1724
self ._tmpfile = None
1725
+ self ._in_file = None
1726
+ self ._outformat = None
1727
+
1725
1728
super (WarpPoints , self ).__init__ (command = command , ** inputs )
1726
1729
1730
+
1727
1731
def _format_arg (self , name , trait_spec , value ):
1728
1732
if name == 'out_file' :
1729
1733
return ''
@@ -1732,6 +1736,7 @@ def _format_arg(self, name, trait_spec, value):
1732
1736
1733
1737
def _parse_inputs (self , skip = None ):
1734
1738
import os .path as op
1739
+
1735
1740
fname , ext = op .splitext (self .inputs .in_coords )
1736
1741
setattr (self , '_in_file' , fname )
1737
1742
setattr (self , '_outformat' , ext [1 :])
@@ -1741,7 +1746,8 @@ def _parse_inputs(self, skip=None):
1741
1746
1742
1747
if ext in ['.vtk' , '.trk' ]:
1743
1748
if self ._tmpfile is None :
1744
- self ._tmpfile = tempfile .NamedTemporaryFile (suffix = '.txt' , dir = os .getcwd ()).name
1749
+ self ._tmpfile = tempfile .NamedTemporaryFile (suffix = '.txt' , dir = os .getcwd (),
1750
+ delete = False ).name
1745
1751
second_args = self ._tmpfile
1746
1752
1747
1753
return first_args + [ second_args ]
@@ -1817,7 +1823,10 @@ def _run_interface(self, runtime):
1817
1823
newpoints = np .fromstring ('\n ' .join (runtime .stdout .split ('\n ' )[1 :]), sep = ' ' )
1818
1824
1819
1825
if not tmpfile is None :
1820
- os .unlink (tmpfile .name )
1826
+ try :
1827
+ os .remove (tmpfile .name )
1828
+ except :
1829
+ pass
1821
1830
1822
1831
out_file = self ._filename_from_source ('out_file' )
1823
1832
@@ -1827,6 +1836,7 @@ def _run_interface(self, runtime):
1827
1836
self ._coords_to_trk (newpoints , out_file )
1828
1837
else :
1829
1838
np .savetxt (out_file , newpoints .reshape (- 1 ,3 ))
1839
+
1830
1840
return runtime
1831
1841
1832
1842
0 commit comments