From 5c97b25fe2e3754a9dac20062741c0b7d6a5b9bb Mon Sep 17 00:00:00 2001 From: Jeremy Fincher Date: Wed, 22 Dec 2004 09:05:38 +0000 Subject: [PATCH] Better error message. --- src/log.py | 11 ++++++++++- 1 file changed, 10 insertions(+), 1 deletion(-) diff --git a/src/log.py b/src/log.py index 980233c20..7e771b02f 100644 --- a/src/log.py +++ b/src/log.py @@ -386,7 +386,16 @@ pluginLogDir = os.path.join(_logDir, 'plugins') if not os.path.exists(pluginLogDir): os.mkdir(pluginLogDir, 0755) -_handler = BetterFileHandler(os.path.join(_logDir, 'misc.log')) +try: + miscLogFilename = os.path.join(_logDir, 'misc.log') + _handler = BetterFileHandler(miscLogFilename) +except EnvironmentError, e: + raise SystemExit, \ + 'Error opening miscellaneous logfile (%s). ' \ + 'Generally, this is because you are running Supybot in a directory ' \ + 'you don\'t have permissions to add files in, or you\'re running ' \ + 'Supybot as a different user than you normal do. The original ' \ + 'error was: %s' % (miscLogFilename, utils.exnToString(e)) _handler.setFormatter(formatter) _handler.setLevel(-1) class PluginLogFilter(logging.Filter):