TypeError: 'float' object is not iterable
type_ = type_ * len(size_or_initializer)
result = _new_value(type_)
result.__init__(size_or_initializer)
return result
修改为:
def RawArray(typecode_or_type, size_or_initializer):
'''
Returns a ctypes array allocated from shared memory
'''
########修改之处##########
size_or_initializer_1 = []
type_ = typecode_to_type.get(typecode_or_type, typecode_or_type)
if isinstance(size_or_initializer, int):
type_ = type_ * size_or_initializer
obj = _new_value(type_)
ctypes.memset(ctypes.addressof(obj), 0, ctypes.sizeof(obj))
return obj
else:
#############修改之处##############
size_or_initializer_1.append(size_or_initializer)
type_ = type_ * len(size_or_initializer_1)
result = _new_value(type_)
# from IPython import embed
# embed()
result.__init__(int(size_or_initializer))
return result