Wow this has gotten awfully strange. I'm running Python on OS X. Here's a quick rundown of what I just found:
(a) If I open a terminal and then run my python script (./script.py), it fails giving me the RLock error I attached in my original e-mail. (b) If I open a FRESH terminal, run the interpreter (python), import threading & logging and then run the same exact code snipped in question (logging.basicConfig( ... )), it works fine (no errors). Further, running "threading.RLock" will generate the expected output. (specifically: <function RLock at 0x10e6870>). However... (c) Let's say I open a terminal and then run my script. It fails with, citing the RLock error. Then, in the *same* terminal window, I open the python interpreter, import logging and threading, and then run the same exact code snippet (logging.basicConfig( ... )). Despite the fact that I have imported all the required modules, I will get the same RLock error I received before. If I attempt to run the command "threading.RLock" in the interpreter, I receive the following error message: >>> threading.RLock Traceback (most recent call last): File "<stdin>", line 1, in <module> AttributeError: 'module' object has no attribute 'RLock' ? ...now I'm even more confused. ;) Thoughts? .james On Sep 29, 2007, at 5:53 PM, Kent Johnson wrote: > 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 _______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor