strange error when trying to log something

Ryszard Szopa ryszard.szopa at gmail.com
Thu Jul 23 05:08:39 EDT 2009


Hi,

I've recently reinstalled Python 2.6 (from DMG) on my Mac, and I am
running into very strage errors. Namely, logging seems to be badly
broken. When I open the interpreter through Django's manage.py shell
and try to use logging, I get the following error:

>>> logging.critical('ala')
------------------------------------------------------------
Traceback (most recent call last):
  File "<ipython console>", line 1, in <module>
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/logging/__init__.py", line 1416, in critical
    root.critical(*((msg,)+args), **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/logging/__init__.py", line 1074, in critical
    self._log(CRITICAL, msg, args, **kwargs)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/logging/__init__.py", line 1142, in _log
    record = self.makeRecord(self.name, level, fn, lno, msg, args,
exc_info, func, extra)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/logging/__init__.py", line 1117, in makeRecord
    rv = LogRecord(name, level, fn, lno, msg, args, exc_info, func)
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/logging/__init__.py", line 272, in __init__
    from multiprocessing import current_process
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/multiprocessing/__init__.py", line 64, in <module>
    from multiprocessing.util import SUBDEBUG, SUBWARNING
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/multiprocessing/util.py", line 121, in <module>
    _afterfork_registry = weakref.WeakValueDictionary()
  File "/Library/Frameworks/Python.framework/Versions/2.6/lib/
python2.6/weakref.py", line 51, in __init__
    UserDict.UserDict.__init__(self, *args, **kw)
TypeError: unbound method __init__() must be called with UserDict
instance as first argument (got WeakValueDictionary instance instead)

I was able to silence the error (and be able to work normally) by
making UserDict.UserDict inherit from object.

Any ideas what is causing the error? Before I updated Python
everything was fine. Am I breaking a lot of things by making
UserDict.UserDict a new style class?

Thanks in advance for any insight.

  -- Ryszard Szopa



More information about the Python-list mailing list