Author Paolo.Elvati
Recipients Paolo.Elvati, bethard
Date 2011-04-12.19:56:29
SpamBayes Score 5.18823e-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:30Paolo.Elvatisetrecipients: + Paolo.Elvati, bethard
2011-04-12 19:56:30Paolo.Elvatisetmessageid: <1302638190.31.0.523851627026.issue11839@psf.upfronthosting.co.za>
2011-04-12 19:56:29Paolo.Elvatilinkissue11839 messages
2011-04-12 19:56:29Paolo.Elvaticreate