X-Git-Url: http://git.onelab.eu/?a=blobdiff_plain;f=planetstack%2Fplanetstack%2Fconfig.py;h=f7d9c9e23ab230809cb2a377a71d0193fe8b0a7b;hb=533d543f53213d701db6d0ee7198ae00dbacfd37;hp=86e3bbd1249680c57ff80b0766b2a6613256b986;hpb=d8ebe8cb91ae3eaa9f74e5e8f552edd28bfaea47;p=plstackapi.git diff --git a/planetstack/planetstack/config.py b/planetstack/planetstack/config.py index 86e3bbd..f7d9c9e 100644 --- a/planetstack/planetstack/config.py +++ b/planetstack/planetstack/config.py @@ -7,7 +7,6 @@ import tempfile import codecs from StringIO import StringIO from util.xml import Xml -from optparse import OptionParser default_config = \ """ @@ -36,15 +35,18 @@ class Config: self.load(self.filename) def get_config_fn(self): - parser = OptionParser(usage="%s [options]" % sys.argv[0], - description="The planetstack observer") - - parser.add_option("-C", "--config-file", dest="config_fn", - help="name of observer config file", metavar="FILENAME", default=DEFAULT_CONFIG_FN) - - (options, args) = parser.parse_args(sys.argv[1:]) - - return options.config_fn + # Look for "-C " to get the + # name of the config file. Using a real OptionParser here is + # problematic as it will throw 'no such option' errors for options + # that it does not understand. + + last = None + for arg in sys.argv: + if (last=="-C"): + return arg + last = arg + + return DEFAULT_CONFIG_FN def _header(self): header = """