[Python-ideas] Command line options
Thomas Heller
theller at ctypes.org
Wed Apr 18 21:02:24 CEST 2007
Sometimes I think it would be great if it were possible to have standard
Python command line options that would allow
- initialize and configure the logging module
- specify requirements for pkg_resources (for eggs installed with --multi-version
All this would avoid having to change logging options or requirements in the
script, or having to implement a command line parser for this stuff in every script.
The idea is to call python in this way:
python --require foo==dev --logging level=DEBUG myscript.py
I have not been able to implement something like this in sitecustomize.py,
because this module is executed when sys.argv is not yet available.
Another possible way to implement this would probably be to set environment vars
and parse those in sitecustomize.py, you would have to call
env option1=foo option2=bar python script.py
then; unfortuately windows does not have an 'env' utility.
Does this sound like a useful idea?
Thomas
More information about the Python-ideas
mailing list