How to include double quotes within a 'script' call?

hi there,

i need to change a rose call in my flow.cylc file from this…

script = "rose task-run --verbose"

… to this…

script = "rose task-run -O '(" + SITE + ")'" --verbose"

but this throws an error…

IllegalValueError: (type=string) [runtime][root]script = "rose task-run -O '(" + SITE + ")'" --verbose"

is there a way to get around this?

thanks,

jonny

Just use a multi-line string value:

script = """
    echo "Hello World!"
"""

What is SITE in your example, BTW - a Jinja2 variable? (if so, it needs to be inside a Jinja2 code block).

1 Like

thanks! that works :slight_smile:

also thanks for the tip/reminder re Jinja2…

    script = """
             rose task-run --verbose -O '(" + {{SITE}} + ")'
             """

where SITE is defined in the rose-suite.conf file.

this results in…

> cylc view -j . |grep -i task\-run |grep NIWA

rose task-run --verbose -O '(" + NIWA + ")'

… which is exactly what i wanted.

cheers,

jonny

1 Like