question on logging module

Cameron Simpson cs at zip.com.au
Wed May 19 00:33:34 EDT 2010


On 18May2010 23:42, frank zhu <frank.zhu.mingyu at gmail.com> wrote:
| Hi,
| >From the python 2.6.4 tutorial, refer to
| http://docs.python.org/release/2.6.4/tutorial/stdlib2.html#logging
| 
| The above example doesn't work for me.
| Here is script log
| 
| #############################################
| 
| oem at oem-desktop ~ $ python -V
| Python 2.6.4
| oem at oem-desktop ~ $ python
| Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15)
| [GCC 4.4.1] on linux2
| Type "help", "copyright", "credits" or "license" for more information.
| >>> import logging
| >>> logging.debug('debug information')
| Traceback (most recent call last):
|   File "<stdin>", line 1, in <module>
| AttributeError: 'module' object has no attribute 'debug'
| 
| ################################################
| 
| I am current using python2.6.4.
| 
| Can anyone point out what's problem?

I don't suppose you have a file called "logging.py" in your working
directory? Python will find it before the system libraries; it is a bad
idea to name .py files the same as library module for this reason.

Cheers,
-- 
Cameron Simpson <cs at zip.com.au> DoD#743
http://www.cskk.ezoshosting.com/cs/

The First Law of Internet Communications:
Be liberal in what you accept, and conservative in what you send. - Jon Postel



More information about the Python-list mailing list