Message133598
| Author |
Paolo.Elvati |
| Recipients |
Paolo.Elvati, bethard |
| Date |
2011年04月12日.19:56:29 |
| SpamBayes Score |
5.188226e-08 |
| Marked as misclassified |
No |
| Message-id |
<1302638190.31.0.523851627026.issue11839@psf.upfronthosting.co.za> |
| In-reply-to |
| Content |
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 |
|
History
|
|---|
| 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 |
|