How to generate Array[object] from python stdout using read_objects

bachimerckbachimerck Member
my wdl file:

# defined structs:
struct testa {
String a
String b
}

struct testb {
String samp
Array[testa] attr
}


task do_stuff {
command <<<
python << CODE
print('\t'.join(['samp','attr']))
print('\t'.join(['1', "[{'a':'1','b':'2'},{'a':'3','b':'4'}]"]))
>>>

output {
Array[testb] out = read_objects(stdout())
}
}

Here is the error, I am getting:

Bad output 'do_stuff.out': AggregatedMessageException: Error(s):
No coercion defined from wom value(s) '"[{'a':'1','b':'2'},{'a':'1','b':'2'}]"' of type 'String' to 'Array[WomCompositeType {
a -> String
b -> String
}]'.


I am expected output as something like this:
[
{ "samp": "1",
"attr": [ {"a":"1","b":"2"}, {"a":"3","b":"4"}]
}
]
Sign In or Register to comment.