Re: Determine actually given command line arguments

2013-05-16 Thread Henry Leyh
On 16.05.2013 08:08, Jussi Piitulainen wrote: Henry Leyh writes: But now I would also like to be able to _write_ such a config file FILE that can be read in a later run. And FILE should contain only those arguments that were given on the command line. Say, I tell argparse to look for argument

Re: Determine actually given command line arguments

2013-05-15 Thread Jussi Piitulainen
Henry Leyh writes: > But now I would also like to be able to _write_ such a config file > FILE that can be read in a later run. And FILE should contain only > those arguments that were given on the command line. > > Say, I tell argparse to look for arguments -s|--sopt STRING, > -i|--iopt INT, -b

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 17:29, Roy Smith wrote: In article , Henry Leyh wrote: On 15.05.2013 14:24, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know whic

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article , Henry Leyh wrote: >On 15.05.2013 14:24, Roy Smith wrote: >> In article , >> Henry Leyh wrote: >> >>> Is there a simple way to determine which >>> command line arguments were actually given on the commandline, i.e. does >>> argparse.ArgumentParser() know which of its namespace memb

Re: Determine actually given command line arguments

2013-05-15 Thread Skip Montanaro
> However, maybe I could ... ... switch to getopt? Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 16:08, Skip Montanaro wrote: Yes, I was trying that and it sort of works with strings if I use something sufficiently improbable like "__UNSELECTED__" as default. But it gets difficult with boolean or even number arguments where you just may not have valid "improbable" defaults.

Re: Determine actually given command line arguments

2013-05-15 Thread Wayne Werner
On Wed, 15 May 2013, Henry Leyh wrote: Yes, I was trying that and it sort of works with strings if I use something sufficiently improbable like "__UNSELECTED__" as default. But it gets difficult with boolean or even number arguments where you just may not have valid "improbable" defaults. You

Re: Determine actually given command line arguments

2013-05-15 Thread Skip Montanaro
> Yes, I was trying that and it sort of works with strings if I use something > sufficiently improbable like "__UNSELECTED__" as default. But it gets > difficult with boolean or even number arguments where you just may not have > valid "improbable" defaults. You could now say, so what, it's th

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 15:00, Oscar Benjamin wrote: On 15 May 2013 13:52, Henry Leyh wrote: On 15.05.2013 14:24, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentPars

Re: Determine actually given command line arguments

2013-05-15 Thread Oscar Benjamin
On 15 May 2013 13:52, Henry Leyh wrote: > On 15.05.2013 14:24, Roy Smith wrote: >> >> In article , >> Henry Leyh wrote: >> >>> Is there a simple way to determine which >>> command line arguments were actually given on the commandline, i.e. does >>> argparse.ArgumentParser() know which of its na

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 14:24, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know which of its namespace members were actually hit during parse_args(). I thin

Re: Determine actually given command line arguments

2013-05-15 Thread Jussi Piitulainen
Colin J. Williams writes: > On 15/05/2013 2:34 AM, Henry Leyh wrote: > > Hello, > > I am writing a program that gets its parameters from a combination > > of config file (using configparser) and command line arguments > > (using argparse). Now I would also like the program to be able to > > _wri

Re: Determine actually given command line arguments

2013-05-15 Thread Dave Angel
On 05/15/2013 08:24 AM, Roy Smith wrote: In article , Henry Leyh wrote: Is there a simple way to determine which command line arguments were actually given on the commandline, i.e. does argparse.ArgumentParser() know which of its namespace members were actually hit during parse_args(). I t

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article , Henry Leyh wrote: > Is there a simple way to determine which > command line arguments were actually given on the commandline, i.e. does > argparse.ArgumentParser() know which of its namespace members were > actually hit during parse_args(). I think what you're looking for is sys

Re: Determine actually given command line arguments

2013-05-15 Thread Colin J. Williams
On 15/05/2013 2:34 AM, Henry Leyh wrote: Hello, I am writing a program that gets its parameters from a combination of config file (using configparser) and command line arguments (using argparse). Now I would also like the program to be able to _write_ a configparser config file that contains onl

Determine actually given command line arguments

2013-05-14 Thread Henry Leyh
Hello, I am writing a program that gets its parameters from a combination of config file (using configparser) and command line arguments (using argparse). Now I would also like the program to be able to _write_ a configparser config file that contains only the parameters actually given on the