[Python] can't get doit task to accept parameters from command line

Discussão em 'Python' iniciado por Stack, Dezembro 14, 2024.

  1. Stack

    Stack Membro Participativo

    the command:

    doit -f ./srvapp/doit-build.py build --stype $argc_type --zone $argc_zone

    the DAG

    def task_build():
    """build"""

    def python_build(stype, zone):
    print(f"TYPE: {stype}, ZONE: {zone}")

    return {
    'actions': [python_build],
    'verbosity':2,
    'params':[
    {'name':'zone', 'default': 'BLANKZONE'},
    {'name':'stype', 'default': 'BLANKSTYPE'}
    ]
    }


    the result:

    TYPE: email-sifter
    ZONE: uat
    ACTION: build
    ERROR: Error parsing Task: option --stype not recognized (parsing options: [CmdOption({'name':'zone', 'short':'','long':'' }), CmdOption({'name':'stype', 'short':'','long':'' })]). Got: ['--stype', 'email-sifter', '--zone', 'uat']


    Not sure why its telling me style not recognized?

    Following doc from here: https://pydoit.org/task-args.html#task-action-parameters

    Continue reading...

Compartilhe esta Página