Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion nipype/interfaces/tests/test_io.py
Original file line number Diff line number Diff line change
Expand Up @@ -709,7 +709,7 @@ def _mock_get_ssh_client(self):

def test_ExportFile(tmp_path):
testin = tmp_path / "in.txt"
testin.write_text("test string")
testin.write_text("test string", encoding='utf-8')
i = nio.ExportFile()
i.inputs.in_file = str(testin)
i.inputs.out_file = str(tmp_path / "out.tsv")
Expand Down
5 changes: 4 additions & 1 deletion nipype/pipeline/engine/tests/test_nodes.py
Original file line number Diff line number Diff line change
Expand Up @@ -352,7 +352,10 @@ def test_NodeExecutionError(tmp_path, monkeypatch):
exebin = tmp_path / 'bin'
exebin.mkdir()
exe = exebin / 'nipype-node-execution-fail'
exe.write_text('#!/bin/bash\necho "Running"\necho "This should fail" >&2\nexit 1')
exe.write_text(
'#!/bin/bash\necho "Running"\necho "This should fail" >&2\nexit 1',
encoding='utf-8',
)
exe.chmod(exe.stat().st_mode | stat.S_IEXEC)
monkeypatch.setenv("PATH", str(exe.parent.absolute()), prepend=os.pathsep)

Expand Down
8 changes: 4 additions & 4 deletions nipype/pipeline/engine/utils.py
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ def write_node_report(node, result=None, is_mapnode=False):

if result is None:
logger.debug('[Node] Writing pre-exec report to "%s"', report_file)
report_file.write_text("\n".join(lines))
report_file.write_text("\n".join(lines), encoding='utf-8')
return

logger.debug('[Node] Writing post-exec report to "%s"', report_file)
Expand All @@ -138,7 +138,7 @@ def write_node_report(node, result=None, is_mapnode=False):
outputs = result.outputs
if outputs is None:
lines += ["None"]
report_file.write_text("\n".join(lines))
report_file.write_text("\n".join(lines), encoding='utf-8')
return

if isinstance(outputs, Bunch):
Expand All @@ -163,7 +163,7 @@ def write_node_report(node, result=None, is_mapnode=False):
subnode_report_files.append("subnode %d : %s" % (i, subnode_file))

lines.append(write_rst_list(subnode_report_files))
report_file.write_text("\n".join(lines))
report_file.write_text("\n".join(lines), encoding='utf-8')
return

lines.append(write_rst_header("Runtime info", level=1))
Expand Down Expand Up @@ -205,7 +205,7 @@ def write_node_report(node, result=None, is_mapnode=False):
write_rst_dict(result.runtime.environ),
]

report_file.write_text("\n".join(lines))
report_file.write_text("\n".join(lines), encoding='utf-8')


def write_report(node, report_type=None, is_mapnode=False):
Expand Down
2 changes: 1 addition & 1 deletion nipype/utils/subprocess.py
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ def run_command(runtime, output=None, timeout=0.01, write_cmdline=False):
stderr = open(errfile, "wb")

if write_cmdline:
(Path(runtime.cwd) / "command.txt").write_text(cmdline)
(Path(runtime.cwd) / "command.txt").write_text(cmdline, encoding='utf-8')

proc = Popen(
cmdline,
Expand Down
2 changes: 1 addition & 1 deletion tools/update_requirements.py
Original file line number Diff line number Diff line change
Expand Up @@ -15,4 +15,4 @@

# Write requirements
lines[1:-1] = requirements
reqs.write_text("\n".join(lines))
reqs.write_text("\n".join(lines), encoding='utf-8')
4 changes: 3 additions & 1 deletion tools/update_zenodo.py
Original file line number Diff line number Diff line change
Expand Up @@ -69,4 +69,6 @@ def decommify(name):

zenodo["creators"] = creators

zenodo_file.write_text("%s\n" % json.dumps(zenodo, indent=2, ensure_ascii=False))
zenodo_file.write_text(
"%s\n" % json.dumps(zenodo, indent=2, ensure_ascii=False), encoding='utf-8'
)