Nipype: traits.String as attribute's argument issues in custom interface [solved]

EDIT: after adquate imports from _future_ and changing string syntax to python3 style it’s working now in python 2.7 (Feel free to remove this post).

Over a year ago I implemented a small custom interface for AFNI, and it worked pretty well for our specific purposes (making a very simple 3dDeconvolve node). Now, I’ve come back to work more deeply on this to make it more generic, but I’ve found that my old code doesn’t work as is with new releases of Nipype (namely, at the moment I’m stuck with String issues).

I’m using:

  • Anaconda version of python 2.7
  • Neurodebian (Jessie)
  • traits 4.6
  • nipype 0.13 cloned from github (which passed the Docker tests shown in the documentation)

For the interface InputSpec(AFNICommandInputSpec) there are a couple of attributes that are lists of Strings, that I had set up like this:

myattribute = traits.List(traits.String(), desc='generic attribute', argstr='%s')

These no longer work, due to type. I understand that there were changes to the nipype source code due to compatibility with Python3, in particular handling strings as unicode.

My questions is what steps should I follow to make my old code compatible with the newest nipype releases?
I’m far from being a developer, but would like to keep in line with the authors’ coding practices and not use ad-hoc solutions. However, at the moment I’m a bit overwhelmed checking all the dependencies and compatibility fixes since last worked with nipype.

Considering now:

  • using traits.Unicode instead of traits.String
  • moving to python 3 and importing unicode_literals as per the new code
  • trying to handle this via the_format_arg method in the definition of the interface class

I appreciate any feedback.
Thank you!

Please use Str, imported from nipype.interfaces.base

Yes, that was one of the things I changed.
Thank you.