Information
We are currently investigating an issue with the editor of some pages. Please save your work and avoid to create new pages until this banner is gone.
ACS is hogging all of the good command options. How can I use the command options I want?
The example below overloads the '-m' option.
#! /usr/bin/env python # Proof that ACS shadows a command line option "-m". # SimpleClient imports BaseClient # Base Client imports ACSCorba where the "bad" function is executed. # # ACSCorba implements the getManager() function which calls # getManagerCorbaloc() where the command line options # "-managerReference" and "-m" are checked. import optparse import sys parser = optparse.OptionParser() parser.add_option("-m", "--max", dest="maxDist", default = 4.0, type="float", help="How far out to search [arcmin]. Default: %default arcmin.") (options, args) = parser.parse_args() # Need to add the program name back for the logger sys.argv = [sys.argv[0]] + args # This import triggers the creation of a _Client object. # Moving it here will pick up the edited sys.argv # rather than the original. from Acspy.Clients.SimpleClient import PySimpleClient simpleClient = PySimpleClient.getInstance("Bar") print "Value of option maxDist = %f" % options.maxDist simpleClient.disconnect() ### end of example
You get what you want, '-m' working as expected. As an added bonus, -managerReference is still available if needed.