strange error when trying to log something
__peter__ at web.de
Sun Jul 26 05:08:10 EDT 2009
> In article <h49ah5$hv3$02$1 at news.t-online.com>,
> Peter Otten <__peter__ at web.de> 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
>><WeakValueDictionary at 140598938447312>
>>>>> import UserDict
>><module 'UserDict' from '/usr/lib/python2.6/UserDict.pyc'>
>>Traceback (most recent call last):
>> File "<stdin>", line 1, in <module>
>> File "/usr/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)
> Nice sleuthing! How did you figure that out?
- The poster's description/remedy makes no sense (to me); have a look at the
- Nothing suspicious except the actual error message. Isn't
WeakValueDictionary a UserDict? Verify.
- There must be two different UserDict classes. This can happen to an
unsuspecting user by importing the main script or by doing a reload().
UserDict is unlikely to be the main script, and web frameworks (django was
mentioned) often use a reload mechanism to avoid frequent server restarts.
- Reproduce the error.
More information about the Python-list