Skip to content

Commit 7dd2a26

Browse files
hmenagertetron
authored andcommitted
fix broken job.json and job script file writing (#604)
* fix broken job.json and job script file writing in python 3, fixes #603.
1 parent a473bb3 commit 7dd2a26

File tree

1 file changed

+3
-2
lines changed

1 file changed

+3
-2
lines changed

cwltool/job.py

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
from __future__ import absolute_import
2+
import codecs
23
import functools
34
import io
45
import json
@@ -549,14 +550,14 @@ def _job_popen(
549550
stdin_path=stdin_path,
550551
)
551552
with open(os.path.join(job_dir, "job.json"), "wb") as f:
552-
json.dump(job_description, f)
553+
json.dump(job_description, codecs.getwriter('utf-8')(f), ensure_ascii=False) # type: ignore
553554
try:
554555
job_script = os.path.join(job_dir, "run_job.bash")
555556
with open(job_script, "wb") as f:
556557
f.write(job_script_contents.encode('utf-8'))
557558
job_run = os.path.join(job_dir, "run_job.py")
558559
with open(job_run, "wb") as f:
559-
f.write(PYTHON_RUN_SCRIPT)
560+
f.write(PYTHON_RUN_SCRIPT.encode('utf-8'))
560561
sp = subprocess.Popen(
561562
["bash", job_script.encode("utf-8")],
562563
shell=False,

0 commit comments

Comments
 (0)