[Tutor] Error Using Logging Module
James
jtp at nc.rr.com
Sat Sep 29 20:23:26 CEST 2007
All,
I'm having some trouble using the Python logging module. Here's the
snippet of code that's causing problems:
--------
# setting up logging using Python's logging module
LOGFILE = "/home/james/log"
logging.basicConfig( level=logging.DEBUG,
format='%(asctime)s <> %(levelname)s <> %(message)s',
datefmt='%a, %d %b %Y %H:%M:%S',
filename=LOGFILE,
filemode='w')
--------
When I run the program, I get this error:
--------
Traceback (most recent call last):
File "./script.py", line 225, in <module>
sys.exit( main() )
File "./script.py", line 119, in main
filemode='w')
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 1237, in basicConfig
hdlr = FileHandler(filename, mode)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 773, in __init__
StreamHandler.__init__(self, stream)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 721, in __init__
Handler.__init__(self)
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 582, in __init__
_acquireLock()
File "/Library/Frameworks/Python.framework/Versions/2.5/lib/
python2.5/logging/__init__.py", line 189, in _acquireLock
_lock = threading.RLock()
AttributeError: 'module' object has no attribute 'RLock'
--------
Ideas?
Thanks!
.james
More information about the Tutor
mailing list