Skip to content

Commit 0a14a1d

Browse files
committed
adding the string check back
1 parent 38c2d76 commit 0a14a1d

File tree

1 file changed

+9
-2
lines changed

1 file changed

+9
-2
lines changed

heudiconv/utils.py

Lines changed: 9 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -107,8 +107,15 @@ def anonymize_sid(sid, anon_sid_cmd):
107107
from subprocess import check_output
108108

109109
cmd = [anon_sid_cmd, sid]
110-
kwargs = {'encoding': 'utf-8'} if sys.version_info[0] >= 3 else {}
111-
return check_output(cmd, **kwargs).strip()
110+
shell_return = check_output(cmd)
111+
112+
### Handle subprocess returning a bytes literal string to a python3 interpreter
113+
if all([sys.version_info[0] > 2, isinstance(shell_return, bytes), isinstance(sid, str)]):
114+
anon_sid = shell_return.decode()
115+
else:
116+
anon_sid = shell_return
117+
118+
return anon_sid.strip()
112119

113120

114121
def create_file_if_missing(filename, content):

0 commit comments

Comments
 (0)