From 068c7501aac36cfe1bce137bcba4e78244ee78f7 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= Date: Tue, 9 Jan 2018 21:58:38 +0100 Subject: [PATCH 1/2] fix broken job.json and job script file writing this fixes #603. --- cwltool/job.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/cwltool/job.py b/cwltool/job.py index 6e6e4a55d..d8e8ffbc2 100644 --- a/cwltool/job.py +++ b/cwltool/job.py @@ -1,4 +1,5 @@ from __future__ import absolute_import +import codecs import functools import io import json @@ -549,14 +550,14 @@ def _job_popen( stdin_path=stdin_path, ) with open(os.path.join(job_dir, "job.json"), "wb") as f: - json.dump(job_description, f) + json.dump(job_description, codecs.getwriter('utf-8')(f), ensure_ascii=False) try: job_script = os.path.join(job_dir, "run_job.bash") with open(job_script, "wb") as f: f.write(job_script_contents.encode('utf-8')) job_run = os.path.join(job_dir, "run_job.py") with open(job_run, "wb") as f: - f.write(PYTHON_RUN_SCRIPT) + f.write(PYTHON_RUN_SCRIPT.encode('utf-8')) sp = subprocess.Popen( ["bash", job_script.encode("utf-8")], shell=False, From 7eae46b6930752119b54352ad604cb4531ccc87c Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Herv=C3=A9=20=20MENAGER?= Date: Wed, 10 Jan 2018 15:21:42 +0100 Subject: [PATCH 2/2] ignore erroneous mypy complaint --- cwltool/job.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cwltool/job.py b/cwltool/job.py index d8e8ffbc2..65a92f312 100644 --- a/cwltool/job.py +++ b/cwltool/job.py @@ -550,7 +550,7 @@ def _job_popen( stdin_path=stdin_path, ) with open(os.path.join(job_dir, "job.json"), "wb") as f: - json.dump(job_description, codecs.getwriter('utf-8')(f), ensure_ascii=False) + json.dump(job_description, codecs.getwriter('utf-8')(f), ensure_ascii=False) # type: ignore try: job_script = os.path.join(job_dir, "run_job.bash") with open(job_script, "wb") as f: