[Tutor] Error Using Logging Module

Kent Johnson kent37 at tds.net
Sat Sep 29 20:58:14 CEST 2007


James wrote:

> 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'

Do you have a module called threading in your path? Maybe you are hiding 
the library module. Try this:

In [14]: import threading
In [15]: threading.__file__
Out[15]: 
'/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.pyc'

to see what threading module you are importing.

Kent


More information about the Tutor mailing list