remove all occurences of assigning sys.argv

This commit is contained in:
Eric Blade 2009-11-22 16:40:56 -05:00
parent 19497dd480
commit 3e7a0ef53c
8 changed files with 222 additions and 229 deletions

View File

@ -51,7 +51,7 @@ if __name__ == "__main__":
parser.add_option("-x", "--failOnError", action="store_true",
help="If this option is passed it quits when it encounters any error")
(options, sys.argv) = parser.parse_args()
(options, argv) = parser.parse_args()
settings={'callFpdbHud':False, 'db-backend':2}
settings['db-host']=options.server

View File

@ -55,19 +55,18 @@ def get_exec_path():
if hasattr(sys, "frozen"): # compiled by py2exe
return os.path.dirname(sys.executable)
else:
print "argv=", sys.argv
pathname = os.path.dirname(sys.argv[0])
return os.path.abspath(pathname)
def get_config(file_name, fallback = True):
"""Looks in cwd and in self.default_config_path for a config file."""
config_path = os.path.join(get_exec_path(), file_name)
print "config_path=", config_path
# print "config_path=", config_path
if os.path.exists(config_path): # there is a file in the cwd
return config_path # so we use it
else: # no file in the cwd, look where it should be in the first place
config_path = os.path.join(get_default_config_path(), file_name)
print "config path 2=", config_path
# print "config path 2=", config_path
if os.path.exists(config_path):
return config_path

View File

@ -43,7 +43,7 @@ class DatabaseManager(gobject.GObject):
import Options
import Configuration
#NOTE: fpdb should perform this globally
(options, sys.argv) = Options.fpdb_options()
(options, argv) = Options.fpdb_options()
config = Configuration.Config(file=options.config, dbname=options.dbname)
#TODO: handle no database present
defaultDatabaseName = config.get_db_parameters().get('db-databaseName', None)
@ -808,5 +808,3 @@ if __name__ == '__main__':
d.connect("destroy", gtk.main_quit)
d.run()
#gtk.main()

View File

@ -731,7 +731,7 @@ def main(argv=None):
gtk.main_quit()
parser = OptionParser()
(options, sys.argv) = parser.parse_args(args = argv)
(options, argv) = parser.parse_args(args = argv)
config = Configuration.Config()
db = None
@ -750,5 +750,3 @@ def main(argv=None):
if __name__ == '__main__':
sys.exit(main())

View File

@ -281,7 +281,7 @@ if __name__== "__main__":
parser.add_option("-q", "--quiet", action="store_false", dest="gui", default=True, help="don't start gui")
parser.add_option("-m", "--minPrint", "--status", dest="minPrint", default="0", type="int",
help="How often to print a one-line status report (0 (default) means never)")
(options, sys.argv) = parser.parse_args()
(options, argv) = parser.parse_args()
config = Configuration.Config()
# db = fpdb_db.fpdb_db()
@ -305,4 +305,3 @@ if __name__== "__main__":
gtk.main()
else:
pass

View File

@ -326,7 +326,7 @@ def main(argv=None):
help="How often to print a one-line status report (0 (default) means never)")
parser.add_option("-u", "--usage", action="store_true", dest="usage", default=False,
help="Print some useful one liners")
(options, sys.argv) = parser.parse_args(args = argv)
(options, argv) = parser.parse_args(args = argv)
if options.usage == True:
#Print usage examples and exit
@ -377,4 +377,3 @@ def main(argv=None):
if __name__ == '__main__':
sys.exit(main())

View File

@ -39,7 +39,7 @@ def fpdb_options():
return (options, argv)
if __name__== "__main__":
(options, sys.argv) = fpdb_options()
(options, argv) = fpdb_options()
print "errorsToConsole =", options.errorsToConsole
print "database name =", options.dbname
print "config file =", options.config

View File

@ -31,7 +31,7 @@ import os
import Options
import traceback
(options, sys.argv) = Options.fpdb_options()
(options, argv) = Options.fpdb_options()
if not options.errorsToConsole:
print "Note: error output is being diverted to fpdb-error-log.txt and HUD-error.txt. Any major error will be reported there _only_."