Closed 19950813 closed 1 year ago
Hello @19950813, Yes, tasks can be written in Python, though it is not as common as using shell script - there is some documentation on how to do it here: https://confluence.ecmwf.int/display/ECFLOW/Native+Python+Tasks
Cheers, Iain
@iainrussell Thanks.
@iainrussell Hello, the screenshot part is reporting an error in my editor, what is the matter? Do I need to deal with it and try to run it, but it is also a running error, what should I do?
Hi @19950813 , looks like you forgot the quote marks, plus there are spaces after the %. It should surely be "%ECF_TRYNO%"
I don't have direct experience of using ECF_MICRO, but I looked here: https://confluence.ecmwf.int/display/ECFLOW/ECF_MICRO and I'd say that to set it in Python you'd need to add a variable in the definition setup, with name ECF_MICRO and value "#" if you want to use '#' as the ecf_micro character. In you case it does not really seem necessary, as you should be able to 'escape' it by using %%, e.g. strftime('%%H:%%M:%%S')
Hi @iainrussell ,Sorry, I haven't paid attention to this issue recently. I just saw it today. The above screenshot is copied directly from the document you sent me, including these places where the grammar is wrong. Please take a look at it carefully, please.
Hello @19950813,
That's strange - when I look at page https://confluence.ecmwf.int/display/ECFLOW/Native+Python+Tasks, I see this: and the %ECF_TRYNO% does not have spaces within it. So looks like an error has crept in on your side.
Probably the second highlighted line should be ok.
Note that this Python script is not intended to be run as it is - it is intended to be run by ecFlow, which will substitute these %% variables with their actual values - the result should be a runnable Python script.