Re: Determine actually given command line arguments

2013-05-16 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,

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

Determine actually given command line arguments

2013-05-15 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

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

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article kmva9j$1hbk$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de 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

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 kmva9j$1hbk$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de 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

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 _write_ a

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 14:24, Roy Smith wrote: In article kmva9j$1hbk$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de 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

Re: Determine actually given command line arguments

2013-05-15 Thread Oscar Benjamin
On 15 May 2013 13:52, Henry Leyh henry.l...@ipp.mpg.de wrote: On 15.05.2013 14:24, Roy Smith wrote: In article kmva9j$1hbk$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de wrote: Is there a simple way to determine which command line arguments were actually given on the commandline,

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 henry.l...@ipp.mpg.de wrote: On 15.05.2013 14:24, Roy Smith wrote: In article kmva9j$1hbk$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de wrote: Is there a simple way to determine which command line

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 the

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 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 Skip Montanaro
However, maybe I could ... ... switch to getopt? wink Skip -- http://mail.python.org/mailman/listinfo/python-list

Re: Determine actually given command line arguments

2013-05-15 Thread Roy Smith
In article kn00fb$8kc$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de wrote: On 15.05.2013 14:24, Roy Smith wrote: In article kmva9j$1hbk$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de wrote: Is there a simple way to determine which command line arguments were actually given

Re: Determine actually given command line arguments

2013-05-15 Thread Henry Leyh
On 15.05.2013 17:29, Roy Smith wrote: In article kn00fb$8kc$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de wrote: On 15.05.2013 14:24, Roy Smith wrote: In article kmva9j$1hbk$1...@gwdu112.gwdg.de, Henry Leyh henry.l...@ipp.mpg.de wrote: Is there a simple way to determine which