Message281128
I'm writing a wrapper that optionally accepts a file and reads more options from that file. The wrapper then needs to pass all of these options and the file to another program (qsub). Here is a minimal example to reproduce the behavior I'm seeing:
>>> import argparse
>>> parser = argparse.ArgumentParser()
>>> parser.add_argument('-a')
>>> parser.add_argument('file', nargs='?')
>>> args = parser.parse_args(['-a', '3', 'myFile'])
>>> print(args)
Namespace(file='myFile', a='3')
>>> parser.parse_args(['-a', '4'], namespace=args)
>>> print(args)
Namespace(file=None, a='4')
The behavior I expect is that the file should remain as 'myFile', but it is being wiped out. Is there any way to prevent this, or is this actually a bug?
I can recreate this problem in Python 2.7 and 3.5. |
|
Date |
User |
Action |
Args |
2016-11-18 15:41:15 | ajstewart | set | recipients:
+ ajstewart |
2016-11-18 15:41:15 | ajstewart | set | messageid: <1479483675.86.0.774570236197.issue28734@psf.upfronthosting.co.za> |
2016-11-18 15:41:15 | ajstewart | link | issue28734 messages |
2016-11-18 15:41:15 | ajstewart | create | |
|