How to run a python script with a configuration file at command line ?
steph_py
stephane.larochelle at gmail.com
Thu Jun 3 13:12:24 EDT 2010
On Jun 3, 12:50 pm, Jean-Michel Pichavant <jeanmic... at sequans.com>
wrote:
> Andreas Jung wrote:
> > optparse
>
> > is your friend.
>
> > -aj
>
> > 2010/6/3 steph_awk <stephane.laroche... at gmail.com
> > <mailto:stephane.laroche... at gmail.com>>
>
> > I have been searching for quite some times without success.
>
> > I have a python script that needs to start from command line and it
> > should have a config file to fill out the detais (itis one program,
> > and many possible configurations).
>
> > something as simple as PHP would be nice %> ./PHPscript -c configfile
>
> > is there such a thing in Python?
> > --
> > http://mail.python.org/mailman/listinfo/python-list
>
> http://docs.python.org/library/configparser.html
>
> JM
configparser is fine if you know the name of the config file, but my
scripts has many config files, I want to pass one by command line
instead of hard coding every possibilities. This may be run as a cron
job, which would automaticaly call up the proper config file depending
on the database...
More information about the Python-list
mailing list