[Tutor] Error Using Logging Module

Alan Gauld alan.gauld at btinternet.com
Sun Sep 30 01:09:30 CEST 2007

"James" <jtp at nc.rr.com> wrote

> (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).

So the error seems to be in the script

Do you modify sys.path in your code anywhere?

> (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:

Do you have a PYTHONPATH setting in your shell config
stuff(.profile etc?)

It looks like the vanilla Python session is picking up the libs
but your script is getting something different. Can you try Kent's
debugging statements inside your script, rather than from
the >>> prompt?

Alan Gauld
Author of the Learn to Program web site

More information about the Tutor mailing list