[issue1436] logging.config.fileConfig, NameError: name 'RotatingFileHandler' is not defined

Marc Abramowitz report at bugs.python.org
Fri May 18 19:01:46 CEST 2012


Marc Abramowitz <msabramo at gmail.com> added the comment:

Or for a practical example, here's how I used the above technique to solve this problem in web2py:

diff --git a/gluon/main.py b/gluon/main.py
index 57bf647..2f69c6b 100644
--- a/gluon/main.py
+++ b/gluon/main.py
@@ -68,6 +68,13 @@ create_missing_folders()
 # set up logging for subsequent imports
 import logging
 import logging.config
+
+# This needed to prevent exception on Python 2.5:
+# NameError: name 'gluon' is not defined
+# See http://bugs.python.org/issue1436
+import gluon.messageboxhandler
+logging.gluon = gluon
+
 logpath = abspath("logging.conf")
 if os.path.exists(logpath):
     logging.config.fileConfig(abspath("logging.conf"))

----------

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue1436>
_______________________________________


More information about the Python-bugs-list mailing list