diff --git a/pyfpdb/HUD_main.py b/pyfpdb/HUD_main.py index f7979552..bae58825 100755 --- a/pyfpdb/HUD_main.py +++ b/pyfpdb/HUD_main.py @@ -35,9 +35,6 @@ import traceback (options, argv) = Options.fpdb_options() -if not options.errorsToConsole: - print "Note: error output is being logged. Any major error will be reported there _only_." - import thread import time import string @@ -79,6 +76,14 @@ class HUD_main(object): log = Configuration.get_logger("logging.conf", "hud", log_dir=self.config.dir_log) log.info("HUD_main starting") log.info("Using db name = %s" % (db_name)) + + if not options.errorsToConsole: + fileName = os.path.join(self.config.dir_log, 'HUD-errors.txt') + print "Note: error output is being diverted to\n"+fileName \ + + "\nAny major error will be reported there _only_.\n" + errorFile = open(fileName, 'w', 0) + sys.stderr = errorFile + self.hud_dict = {} self.hud_params = self.config.get_hud_ui_parameters() diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 5bef3503..d5e0350d 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -53,7 +53,7 @@ if os.name == 'nt': raw_input("Press ENTER to continue.") exit() -print "Python " + sys.version[0:3] + '...\n' +print "Python " + sys.version[0:3] + '...' import traceback import threading @@ -62,12 +62,6 @@ import string cl_options = string.join(sys.argv[1:]) (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_." - errorFile = open('fpdb-error-log.txt', 'w', 0) - sys.stderr = errorFile - -#import logging import logging, logging.config try: @@ -910,6 +904,13 @@ This program is licensed under the AGPL3, see docs"""+os.sep+"agpl-3.0.txt") self.window.show() self.load_profile() + if not options.errorsToConsole: + fileName = os.path.join(self.config.dir_log, 'fpdb-errors.txt') + print "\nNote: error output is being diverted to fpdb-errors.txt and HUD-errors.txt in\n" \ + + self.config.dir_log + "Any major error will be reported there _only_.\n" + errorFile = open(fileName, 'w', 0) + sys.stderr = errorFile + self.statusIcon = gtk.StatusIcon() if os.path.exists(os.path.join(sys.path[0], '../gfx/fpdb-cards.png')): self.statusIcon.set_from_file(os.path.join(sys.path[0], '../gfx/fpdb-cards.png'))