strange error when trying to log something

Aahz aahz at
Sat Jul 25 12:12:49 EDT 2009

In article <h49ah5$hv3$02$1 at>,
Peter Otten  <__peter__ at> wrote:
>I have a hunch that you are triggering a reload() somewhere. Example:
>Python 2.6.2 (release26-maint, Apr 19 2009, 01:58:18)
>[GCC 4.3.3] on linux2
>Type "help", "copyright", "credits" or "license" for more information.
>>>> import weakref
>>>> weakref.WeakValueDictionary()
><WeakValueDictionary at 140598938447312>
>>>> import UserDict
>>>> reload(UserDict)
><module 'UserDict' from '/usr/lib/python2.6/UserDict.pyc'>
>>>> weakref.WeakValueDictionary()
>Traceback (most recent call last):
>  File "<stdin>", line 1, in <module>
>  File "/usr/lib/python2.6/", 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)

Nice sleuthing!  How did you figure that out?
Aahz (aahz at           <*>

"At Resolver we've found it useful to short-circuit any doubt and just        
refer to comments in code as 'lies'. :-)"
--Michael Foord paraphrases Christian Muirhead on python-dev, 2009-03-22

More information about the Python-list mailing list