From f992edfcba4bdeefb34099edf76aacab02118d31 Mon Sep 17 00:00:00 2001 From: Matthew Brett Date: Fri, 5 Aug 2016 20:12:27 -0700 Subject: [PATCH] BF: fix recursion error on Python 3.3 Python 3.3 seems to get upset with filling format string values from byte strings. See: http://nipy.bic.berkeley.edu/builders/nibabel-py3.3/builds/240/steps/shell_5/logs/stdio --- nibabel/streamlines/trk.py | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/nibabel/streamlines/trk.py b/nibabel/streamlines/trk.py index 9eeef0f1cd..8c7873d109 100644 --- a/nibabel/streamlines/trk.py +++ b/nibabel/streamlines/trk.py @@ -728,6 +728,10 @@ def __str__(self): vars['property_names'] = "\n ".join([asstr(s) for s in vars['property_name'] if len(s) > 0]) + # Make all byte strings into strings + # Fixes recursion error on Python 3.3 + vars = dict((k, asstr(v) if hasattr(v, 'decode') else v) + for k, v in vars.items()) return """\ MAGIC NUMBER: {MAGIC_NUMBER} v.{version}