From c7393951893011df98986bd89b82af4df08d33cc Mon Sep 17 00:00:00 2001 From: steffen123 Date: Fri, 7 Nov 2008 00:14:25 +0000 Subject: [PATCH] p140 - added CLI option to fpdb.py to control redirection of stderr --- pyfpdb/fpdb.py | 14 +++++++++++--- pyfpdb/fpdb_import.py | 2 +- 2 files changed, 12 insertions(+), 4 deletions(-) diff --git a/pyfpdb/fpdb.py b/pyfpdb/fpdb.py index 134e6ea1..ad4d3f3d 100755 --- a/pyfpdb/fpdb.py +++ b/pyfpdb/fpdb.py @@ -17,10 +17,18 @@ import os import sys +from optparse import OptionParser -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 + +parser = OptionParser() +parser.add_option("-x", "--errorsToConsole", action="store_true", + help="If passed error output will go to the console rather than .") +(options, sys.argv) = parser.parse_args() + +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 pygtk pygtk.require('2.0') diff --git a/pyfpdb/fpdb_import.py b/pyfpdb/fpdb_import.py index ffa06cff..5398c83b 100755 --- a/pyfpdb/fpdb_import.py +++ b/pyfpdb/fpdb_import.py @@ -292,4 +292,4 @@ class Importer: if __name__ == "__main__": - print "CLI for fpdb_import is currently on vacation please check in later" + print "CLI for fpdb_import is now available as CliFpdb.py"