Skip to content

Commit

Permalink
fix broken job.json and job script file writing (#604)
Browse files Browse the repository at this point in the history
* fix broken job.json and job script file writing in python 3, fixes #603.
  • Loading branch information
hmenager authored and tetron committed Jan 10, 2018
1 parent a473bb3 commit 7dd2a26
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions cwltool/job.py
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
from __future__ import absolute_import
import codecs
import functools
import io
import json
Expand Down Expand Up @@ -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) # type: ignore
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,
Expand Down

0 comments on commit 7dd2a26

Please sign in to comment.