We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 1776ed4 commit 6e33237Copy full SHA for 6e33237
nipype/utils/filemanip.py
@@ -38,6 +38,7 @@
38
('.BRIK', '.HEAD'),
39
]
40
41
+PY3 = sys.version_info[0] >= 3
42
43
class FileNotFoundError(Exception):
44
pass
@@ -877,12 +878,18 @@ def canonicalize_env(env):
877
878
if os.name != 'nt':
879
return env
880
881
+ # convert unicode to string for python 2
882
+ if not PY3:
883
+ from future.utils import bytes_to_native_str
884
out_env = {}
885
for key, val in env.items():
886
if not isinstance(key, bytes):
887
key = key.encode('utf-8')
888
if not isinstance(val, bytes):
889
val = val.encode('utf-8')
890
891
+ key = bytes_to_native_str(key)
892
+ val = bytes_to_native_str(val)
893
out_env[key] = val
894
return out_env
895
0 commit comments