Message327867
The results of reading one of these @-prefix files are just spliced into the `argv` list before it is parsed. This is done early in the parsing method, in the
_read_args_from_files
method. The documentation illustrates how this file reading can be modified to take several strings from each line:
https://docs.python.org/3/library/argparse.html#argparse.ArgumentParser.convert_arg_line_to_args
That shouldn't be taken as the only possible modification.
That said, I don't see how reading from a JSON or YAML file fits with this mechanism. Presumably those would define some dictionary like key:value pairs. I assume you'd want to enter those directly into the Namespace, not the argv list that will be parsed. Or otherwise merged with a dictionary produced by parsing the other commandline strings.
So what you want to do with a JSON file, and how that relates to argparse is not clear. You need to elaborate before we can discuss this issue further.
You might want to search on Stackoverflow with the tags '[argparse] [json]' to see how others have tried to use the two together. |
|
Date |
User |
Action |
Args |
2018-10-17 06:47:22 | paul.j3 | set | recipients:
+ paul.j3, bethard, derelbenkoenig |
2018-10-17 06:47:21 | paul.j3 | set | messageid: <1539758841.97.0.788709270274.issue35005@psf.upfronthosting.co.za> |
2018-10-17 06:47:21 | paul.j3 | link | issue35005 messages |
2018-10-17 06:47:21 | paul.j3 | create | |
|