From afdb3b71c8da860389ba075d22a3b55f05b57e01 Mon Sep 17 00:00:00 2001 From: Cameron Patrick Date: Sun, 1 Aug 2004 05:39:59 +0000 Subject: [PATCH] move argument parsing out into a separate function --- sql-edition/servers/VendServer.py | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-) diff --git a/sql-edition/servers/VendServer.py b/sql-edition/servers/VendServer.py index dd9739d..de763f2 100755 --- a/sql-edition/servers/VendServer.py +++ b/sql-edition/servers/VendServer.py @@ -379,8 +379,7 @@ def connect_to_vend(options, DBServer, DBName, DBUser, DBPassword, ServiceName, return rfh, wfh -if __name__ == '__main__': - import ConfigParser +def parse_args(): from optparse import OptionParser op = OptionParser(usage="%prog [OPTION]...") @@ -393,6 +392,13 @@ if __name__ == '__main__': if len(args) != 0: op.error('extra command line arguments: ' + ' '.join(args)) + return options + +if __name__ == '__main__': + import ConfigParser + + options = parse_args() + try: cp = ConfigParser.ConfigParser() cp.read(options.config_file) -- 2.20.1