Message133598
Hi,
when a default is specified for a file argument that is open with writing permission (FileType('w')), the default file is always created even if the argument is specified in the command line.
For example he code:
import argparse
parser = argparse.ArgumentParser()
parser.add_argument(
"-o",
default = 'fake',
dest = 'OutputFile',
type = argparse.FileType('w')
)
args = parser.parse_args()
will create the empty file "fake" even if the -o option is given.
The value inside the code of args.Outputfile is not affected.
Paolo |
|
Date |
User |
Action |
Args |
2011-04-12 19:56:30 | Paolo.Elvati | set | recipients:
+ Paolo.Elvati, bethard |
2011-04-12 19:56:30 | Paolo.Elvati | set | messageid: <1302638190.31.0.523851627026.issue11839@psf.upfronthosting.co.za> |
2011-04-12 19:56:29 | Paolo.Elvati | link | issue11839 messages |
2011-04-12 19:56:29 | Paolo.Elvati | create | |
|