[Tutor] Error Using Logging Module

Kent Johnson kent37 at tds.net
Sat Sep 29 23:53:32 CEST 2007


James wrote:
> Here's the output of the requested commands:
> 
>  >>> import threading
>  >>> threading.__file__
> '/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5/threading.pyc' 
> 
>  >>>
> 
> Looks identical to the output you attached.

Strange. How about
 >>> import threading
 >>> threading.RLock
<function RLock at 0x10e6870>

?

Kent

> 
> .james
> 
> 
> On Sep 29, 2007, at 2:58 PM, Kent Johnson wrote:
> 
>> 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