How to get argparse to read arguments from a file with an option after positional arguments
<p>I would like to be able to put command-line arguments in a file, and then pass them to a python program, with argparse, using an option rather than a prefix character, for instance:
<code>
$ python myprogram.py 1 2 --foo 1 -A somefile.txt --bar 2
</code>
This is almost the same as <a href="https://stackoverflow.com/questions/27433316/how-to-get-argparse-to-read-arguments-from-a-file-with-an-option-rather-than-pre">this question</a>, except that I need to have some positional arguments at the start; when that solution calls <code>parse_args</code>, it fails if the file does not have the positional arguments in it.</p>