common-workflow-lab/python-cwlgen

Export command in README file does not work

golharam opened this issue · 2 comments

When running the example given in the README, I see this:

$ python make_echotool.py 
#!/usr/bin/env cwl-runner

baseCommand: echo
class: CommandLineTool
cwlVersion: v1.0
id: echo-tool
inputs:
- id: myParamId
  type: string

Traceback (most recent call last):
  File "make_echotool.py", line 21, in <module>
    tool_object.export(f)
  File "/Users/golharr/workspace/CWL/env/lib/python2.7/site-packages/cwlgen/commandlinetool.py", line 256, in export
    out_write = open(outfile, "w")
TypeError: coercing to Unicode: need string or buffer, file found

I had to make these changes to get it to work:

# print to file
#with open("echotool.cwl", "w") as f:
#    tool_object.export(f)
tool_object.export("echotool.cwl")

I also see examples/readme_example.py does not have the export to file chunk of code.

Thanks @golharam for raising this issue! I was able to replicate your problem and have fixed the readme example and the examples/readme_example.py in #29 per your suggestion.