TypeError: cannot create weak reference to 'builtin_function_or_method' object
Kaleb Pederson
kibab at icehouse.net
Sat Aug 31 15:10:13 EDT 2002
The error listed has been popping up everywhere. I, somehow?, made it so
that it doesn't error on the previous lines. Now I get the same error in
the following code under different conditions. Another strange artifact is
that if I uncomment my print lines I don't get the error. Most of the
values in the self.values list are 'None' as I'm creating a new object.
class ...:
def setInterfaceFromObject(self,obj = None):
if not isinstance(obj,I_Stone):
self.stone = I_Stone()
brand = self.stone.get_brand()
brand_name = ''
if brand != None:
brand_name = brand.get_name()
self.values = [
[self.stone.get_blemishes(), BLEMISHES_LIST],
[brand_name,self.brand_dict.keys()],
[self.stone.get_brilliancy(), BRILLIANCY_LIST],
[self.stone.get_certificate(), CERTIFICATE_LIST],
self.stone.get_certificate_num(),
[self.stone.get_clarity(), CLARITY_LIST],
[self.stone.get_color(),COLOR_LIST],
self.stone.get_depth(),
[self.stone.get_finish(), FINISH_LIST],
[self.stone.get_fluorescence(), FLUORESCENCE_LIST],
self.stone.get_height(),
self.stone.get_laser_inscription(),
self.stone.get_len(),
[self.stone.get_luster(), LUSTER_LIST],
[self.stone.get_proportions(),PROPORTIONS_LIST],
self.stone.get_quantity(),
self.stone.get_scene(),
[self.stone.get_shape_cut(),SHAPE_CUT_LIST],
[self.stone.get_stone_type(),STONE_TYPE_LIST],
[self.stone.get_symmetry(),SYMMETRY_LIST],
self.stone.get_weight(),
self.stone.get_weight_from(),
self.stone.get_weight_to(),
self.stone.get_width()
]
if len(self.values) != len(self.members):
print "wrong lengths!!!!"
return
# print self.values
# print self.members
for i in range(len(self.values)):
self.Set(self.members[i],self.values[i])
return
Traceback is as follows:
Traceback (most recent call last):
File "<basepath>/gem/src/gui/WatchEditInterfaceImpl.py", line 159, in
addStone
self.sei.setInterfaceFromObject(stone)
File "<basepath>/src/gui/StoneEditInterfaceImpl.py", line 154, in
setInterfaceFromObject
for i in range(len(self.values)):
TypeError: cannot create weak reference to 'builtin_function_or_method'
object
>Kaleb Pederson wrote:
>> I have some code as follows:
>>
>> ...
>> print type(None) != types.StringType
>> ...
>>
>> Which results in:
>> TypeError: cannot create weak reference to 'builtin_function_or_method'
>> object
>
>strange. in fact, doubly strange because i don't get the meaning of
>the above line.
I was simply printing out the truth value of the line.
>
>Can you post the real code (the whole method) along with a traceback?
>
> holger
More information about the Python-list
mailing list