Repository: nipy/nipype

Issue:
 TraitError: The 'file_name' trait of a PolyDataWriter instance  must be a unicode string  ...
### Summary
trying to update debian package for 1.0.1-97-g803982c21 .  not yet sure if that is nohow specifics of my system (will try now in a clean chroot etc) with python-traits 4.6.0-1+b1.  Note that issue subject reflects only one of the two failures
```
=================================== FAILURES ===================================
_____________________________ test_ident_distances _____________________________
[gw3] linux2 -- Python 2.7.14 /usr/bin/python

tmpdir = local('/tmp/pytest-of-yoh/pytest-0/popen-gw3/test_ident_distances0')

    @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed")
    def test_ident_distances(tmpdir):
        tmpdir.chdir()
    
        in_surf = example_data('surf01.vtk')
        dist_ident = m.ComputeMeshWarp()
        dist_ident.inputs.surface1 = in_surf
        dist_ident.inputs.surface2 = in_surf
>       dist_ident.inputs.out_file = tmpdir.join('distance.npy')

/home/yoh/deb/gits/pkg-exppsy/build-area/nipype-1.0.1+git97-g803982c21/nipype/algorithms/tests/test_mesh_ops.py:24: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/home/yoh/deb/gits/pkg-exppsy/build-area/nipype-1.0.1+git97-g803982c21/nipype/interfaces/base/traits_extension.py:103: in validate
    validated_value = super(File, self).validate(object, name, value)
/usr/lib/python2.7/dist-packages/traits/trait_types.py:411: in validate
    self.error( object, name, value )
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <nipype.interfaces.base.traits_extension.File object at 0x7f2809ce4110>
object = 
ignore_exception = False
metric = euclidean
out_file = distance.npy
out_warp .../nipype-1.0.1+git97-g803982c21/nipype/testing/data/surf01.vtk
weighting = none

name = 'out_file'
value = local('/tmp/pytest-of-yoh/pytest-0/popen-gw3/test_ident_distances0/distance.npy')

    def error ( self, object, name, value ):
        """Raises a TraitError exception.
    
            Parameters
            ----------
            object : object
                The object whose attribute is being assigned.
            name : str
                The name of the attribute being assigned.
            value : object
                The proposed new value for the attribute.
    
            Description
            -----------
            This method is called by the validate() method when an assigned value
            is not valid. Raising a TraitError exception either notifies the user of
            the problem, or, in the case of compound traits, provides a chance for
            another trait handler to handle to validate the value.
            """
        raise TraitError( object, name, self.full_info( object, name, value ),
>                         value )
E       TraitError: The 'out_file' trait of a ComputeMeshWarpInputSpec instance must be a file name, but a value of local('/tmp/pytest-of-yoh/pytest-0/popen-gw3/test_ident_distances0/distance.npy') <class 'py._path.local.LocalPath'> was specified.

/usr/lib/python2.7/dist-packages/traits/trait_handlers.py:172: TraitError
_____________________________ test_trans_distances _____________________________
[gw1] linux2 -- Python 2.7.14 /usr/bin/python

tmpdir = local('/tmp/pytest-of-yoh/pytest-0/popen-gw1/test_trans_distances0')

    @pytest.mark.skipif(VTKInfo.no_tvtk(), reason="tvtk is not installed")
    def test_trans_distances(tmpdir):
        from ...interfaces.vtkbase import tvtk
    
        in_surf = example_data('surf01.vtk')
        warped_surf = tmpdir.join('warped.vtk')
    
        inc = np.array([0.7, 0.3, -0.2])
    
        r1 = tvtk.PolyDataReader(file_name=in_surf)
        vtk1 = VTKInfo.vtk_output(r1)
        r1.update()
        vtk1.points = np.array(vtk1.points) + inc
    
>       writer = tvtk.PolyDataWriter(file_name=warped_surf)

/home/yoh/deb/gits/pkg-exppsy/build-area/nipype-1.0.1+git97-g803982c21/nipype/algorithms/tests/test_mesh_ops.py:47: 
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 
/usr/lib/python2.7/dist-packages/tvtk/tvtk_classes.zip/tvtk_classes/poly_data_writer.py:46: in __init__
    tvtk_base.TVTKBase.__init__(self, vtk.vtkPolyDataWriter, obj, update, **traits)
/usr/lib/python2.7/dist-packages/tvtk/tvtk_base.py:336: in __init__
    super(TVTKBase, self).__init__(**traits)
_ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ _ 

self = <traits.trait_handlers.TraitCompound object at 0x7f32d813f890>
object = <tvtk.tvtk_classes.poly_data_writer.PolyDataWriter object at 0x7f32b66056b0>
name = 'file_name'
value = local('/tmp/pytest-of-yoh/pytest-0/popen-gw1/test_trans_distances0/warped.vtk')

    def error ( self, object, name, value ):
        """Raises a TraitError exception.
    
            Parameters
            ----------
            object : object
                The object whose attribute is being assigned.
            name : str
                The name of the attribute being assigned.
            value : object
                The proposed new value for the attribute.
    
            Description
            -----------
            This method is called by the validate() method when an assigned value
            is not valid. Raising a TraitError exception either notifies the user of
            the problem, or, in the case of compound traits, provides a chance for
            another trait handler to handle to validate the value.
            """
        raise TraitError( object, name, self.full_info( object, name, value ),
>                         value )
E       TraitError: The 'file_name' trait of a PolyDataWriter instance must be a unicode string or a value of type 'str' or None, but a value of local('/tmp/pytest-of-yoh/pytest-0/popen-gw1/test_trans_distances0/warped.vtk') <class 'py._path.local.LocalPath'> was specified.

/usr/lib/python2.7/dist-packages/traits/trait_handlers.py:172: TraitError

```


Discussion:

Resolving patch:
diff --git a/doc/conf.py b/doc/conf.py
--- a/doc/conf.py
+++ b/doc/conf.py
@@ -82,7 +82,7 @@
 # The short X.Y version.
 version = nipype.__version__
 # The full version, including alpha/beta/rc tags.
-release = "1.0.1"
+release = "1.0.2"
 
 # The language for content autogenerated by Sphinx. Refer to documentation
 # for a list of supported languages.
diff --git a/nipype/info.py b/nipype/info.py
--- a/nipype/info.py
+++ b/nipype/info.py
@@ -11,7 +11,7 @@
 # full release.  '.dev' as a version_extra string means this is a development
 # version
 # Remove -dev for release
-__version__ = '1.0.2-dev'
+__version__ = '1.0.2'
 
 
 def get_nipype_gitversion():


Test patch:
diff --git a/nipype/algorithms/tests/test_mesh_ops.py b/nipype/algorithms/tests/test_mesh_ops.py
--- a/nipype/algorithms/tests/test_mesh_ops.py
+++ b/nipype/algorithms/tests/test_mesh_ops.py
@@ -21,7 +21,7 @@ def test_ident_distances(tmpdir):
     dist_ident = m.ComputeMeshWarp()
     dist_ident.inputs.surface1 = in_surf
     dist_ident.inputs.surface2 = in_surf
-    dist_ident.inputs.out_file = tmpdir.join('distance.npy')
+    dist_ident.inputs.out_file = tmpdir.join('distance.npy').strpath
     res = dist_ident.run()
     assert res.outputs.distance == 0.0
 
@@ -35,7 +35,7 @@ def test_trans_distances(tmpdir):
     from ...interfaces.vtkbase import tvtk
 
     in_surf = example_data('surf01.vtk')
-    warped_surf = tmpdir.join('warped.vtk')
+    warped_surf = tmpdir.join('warped.vtk').strpath
 
     inc = np.array([0.7, 0.3, -0.2])
 
@@ -51,7 +51,7 @@ def test_trans_distances(tmpdir):
     dist = m.ComputeMeshWarp()
     dist.inputs.surface1 = in_surf
     dist.inputs.surface2 = warped_surf
-    dist.inputs.out_file = tmpdir.join('distance.npy')
+    dist.inputs.out_file = tmpdir.join('distance.npy').strpath
     res = dist.run()
     assert np.allclose(res.outputs.distance, np.linalg.norm(inc), 4)
     dist.inputs.weighting = 'area'