logging: AttributeError: 'module' object has no attribute 'getLogger'
Duncan Booth
duncan.booth at invalid.invalid
Sun May 23 10:06:22 EDT 2010
Frank GOENNINGER <dg1sbg at googlemail.com> wrote:
>
> When trying to execute main() I get:
>
> Traceback (most recent call last):
> File "/.../src/pib/logging.py", line 37, in <module>
> main()
> File "/.../src/pib/logging.py", line 33, in main
> mylogger = PIBLogger('/tmp/pib.log')
> File "/...src/pib/logging.py", line 23, in __init__
> self.logger = logging.getLogger('PIBLogger')
> AttributeError: 'module' object has no attribute 'getLogger'
>
> I double checked and yes, getLogger is there. Why is the interpreter
> asking for an "attribute" here ? Any hints on what I am doing wrong ?
>
You're source file appears to be called logging.py, so when you do 'import
logging' it just imports itself. The system logging.py has a getLogger
function, but *your* logging.py doesn't.
More information about the Python-list
mailing list