Hello, I have been trying to find an example of how to deal with options that have spaces in them. I am using jython, which is the same I think as python 2.2.3. I feebly tried to use optparse and argparse with no success (got gettext, locale, and optparse). The code is as follows:
try: (opts, args) = getopt.getopt(sys.argv[1:], "hs:p:n:j:d:l:u:c:t:w:q:v", ["help", "server=", "port=", "dsName=","jndiName=","driverName=","driverURL=","user=","passWD=","targetServer=","whereProp=","testTableName=","version"]) except getopt.GetoptError: usage() for opt in opts: (key, value) = opt if (key in ("-v", "--version")): print "Version: " + version sys.exit(1) if (key in ("-h", "--help")): usage() if (key in ("-s", "--server")): server = value if (key in ("-p", "--port")): port = value if (key in ("-n", "--dsName")): dsName = value if (key in ("-j", "--jndiName")): jndiName = value if (key in ("-d", "--driverName")): driverName = value if (key in ("-l", "--driverURL")): driverURL = value if (key in ("-u", "--user")): user = value if (key in ("-c", "--passWD")): passWD = value if (key in ("-t", "--targetServer")): targetServer = value if (key in ("-q", "--testTableName")): testTableName = value if (key in ("-w", "--whereProp")): whereProp = value print "server: " + server print "port: " + port print "dsName: " + dsName print "jndiName: " + jndiName print "driverName: " + driverName print "driverURL: " + driverURL print "user: " + user print "passWD: " + passWD print "testtable: " + testTableName print "targetServer: " + targetServer print "whereProp: " + whereProp The one that gives me trouble is with the -q option, because it can look like: -q "SQL 1 TABLE". It returns back just SQL. How do I get it to return the whole thing that is in double quotes? David -- http://mail.python.org/mailman/listinfo/python-list