Re: script that parses command line, and execfile('')

2008-11-04 Thread Tim Chase
Sandip Bhattacharya wrote: On Nov 4, 12:43 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: def main(argv=None): if argv is None: argv = sys.argv[1:] ... Wouldn't that make optparse miss the first parameter sys.argv[1] mistaking it to be the name of the current program? Nope...opt

Re: script that parses command line, and execfile('')

2008-11-04 Thread Sandip Bhattacharya
On Nov 4, 12:43 am, "Diez B. Roggisch" <[EMAIL PROTECTED]> wrote: > def main(argv=None): >      if argv is None: argv = sys.argv[1:] >      ... Wouldn't that make optparse miss the first parameter sys.argv[1] mistaking it to be the name of the current program? - Sandip -- http://mail.python.org/m

Re: script that parses command line, and execfile('')

2008-11-03 Thread Diez B. Roggisch
TP schrieb: Hello, I have a script that uses the "optparse" package to parse the command line. For example: $ script.py --help # displays help about script.py Is this possible to call such a script with execfile('') once in the Python interactive shell? execfile( 'script.py' ) I get errors

Re: script that parses command line, and execfile('')

2008-11-03 Thread Arnaud Delobelle
TP <[EMAIL PROTECTED]> writes: > Hello, > > I have a script that uses the "optparse" package to parse the command line. > For example: > > $ script.py --help > # displays help about script.py > > Is this possible to call such a script with execfile('') once in the Python > interactive shell? > >>>