Skip to content

if arg is required then cannot run from param file #32

Open
@doutriaux1

Description

@doutriaux1

script

from __future__ import print_function
import cdp

parser = cdp.cdp_parser.CDPParser()

parser.add_argument("-a","--Aarg",default=7,help="A value",required=True)
parser.add_argument("-b","--Barg",default=8,help="A value")
parser.add_argument("-c","--Carg",default=9,help="A value")
parser.add_argument("-d","--Darg",default=6,help="A value")


P = parser.get_parameters()[0]

print("A:",P.Aarg)
print("B:",P.Barg)
print("C:",P.Carg)
print("D:",P.Darg)

myparam.py

Aarg=10
Barg=11
Carg=12
Darg=13

runnnig with -p myparam:

doutriaux1@crunchy:[~]:[20530]> python test_cdp_param.py -p myparam.py 
usage: test_cdp_param.py [-h] [-p PARAMETERS]
                         [--diags OTHER_PARAMETERS [OTHER_PARAMETERS ...]]
                         [-n NUM_WORKERS] [--scheduler_addr SCHEDULER_ADDR]
                         [-g GRANULATE [GRANULATE ...]] -a AARG [-b BARG]
                         [-c CARG] [-d DARG]
test_cdp_param.py: error: the following arguments are required: -a/--Aarg

Metadata

Metadata

Assignees

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions