Simon,

you can access commandline arguments via

import sys

then 

sys.argv

is a list of the command line options.

Parsing them is a well understood and mutliple times solved problem:

http://docs.python.org/library/argparse.html#module-argparse
http://docs.python.org/release/2.5.2/lib/module-optparse.html
http://docs.python.org/library/getopt.html

You may read up on those modules from the standard library, PLEASE do NOT create another option parser :)

(argparse is also available as module for Python 2.6, please google it if you are not on 2.7)

Harald

On Sun, Nov 21, 2010 at 11:14, Simon Lange <ms-leipzig@gmx.de> wrote:
hallo,

as a newbie in python the following question:

I want to build a EXE from a PY-script, this works fine - thanks for
Py2Exe. but how to parse the commandline-arguments i give to the *.exe to
work with them inside the PY-code ? I mean a call like "abc.exe
testfile.txt" and work with "testfile.txt" inside the script ?

best regards

Simon


--
Dr. Simon Lange
PARTEC GmbH
0341-9213491

------------------------------------------------------------------------------
Beautiful is writing same markup. Internet Explorer 9 supports
standards for HTML5, CSS3, SVG 1.1,  ECMAScript5, and DOM L2 & L3.
Spend less time writing and  rewriting code and more time creating great
experiences on the web. Be a part of the beta today
http://p.sf.net/sfu/msIE9-sfdev2dev
_______________________________________________
Py2exe-users mailing list
Py2exe-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/py2exe-users



--
GHUM GmbH
Harald Armin Massa
Spielberger Straße 49
70435 Stuttgart
0173/9409607

Amtsgericht Stuttgart, HRB 734971
-
persuadere.
et programmare