Python 2.2 Weak Reference TypeError
doug101NOSPAM at xecu.net
Tue Jan 15 03:02:34 CET 2002
My program has an error with Python 2.2 that it doesn't have with 2.1.
The following exception is generated:
TypeError: cannot create weak reference to 'builtin_function_or_method'
from the sort command in the following function:
names = myDict.keys()
If "print names" is placed before the sort, the list on keys (unicode
strings) prints fine, but the exception is still thrown by the sort
command. If the sort command is replaced by "for item in names: print
item", the for loop throws the same exception.
Strangely, an earlier function that has the same lines (referencing the same
dictionary keys) works fine. And subsequent calls to setCurrentSel also
work fine (the first one always fails). And there are no changes to
myDict between these function calls.
I can save the list of keys from the earlier call as a work-around, but I
would like to understand what is causing this problem. This is a PyQt
program running on a Linux Mandrake 8.1 system.
More information about the Python-list