我有下面提到的字段表:
bin_data
生成以下API
data
除此之外我还有一个二进制搅拌blobName = builder.CreateString(blob_name)
Blob.BlobStartDataVector(builder, len(blob_data))
for i in reversed(range(0, len(blob_data))):
builder.PrependByte(blob_data[i]) #Error here
blob_bin_data = builder.EndVector(len(blob_data))
Blob.BlobStart(builder)
Blob.BlobAddName(builder, blobName)
Blob.BlobAddSize(builder, 30) #for example size is 30
Blob.BlobAddData(builder, blob_bin_data)
binaryBlob = BlobEnd(builder)
,现在我想将这些数据填充到Blob的 builder.PrependByte(blob_data[i])
File "build/bdist.linux-x86_64/egg/flatbuffers/builder.py", line 544, in PrependByte
File "build/bdist.linux-x86_64/egg/flatbuffers/builder.py", line 472, in Prepend
File "build/bdist.linux-x86_64/egg/flatbuffers/builder.py", line 627, in Place
File "build/bdist.linux-x86_64/egg/flatbuffers/number_types.py", line 148, in enforce_number
TypeError: bad number for type uint8
向量中。怎么做?
我有以下代码:
{{1}}
使用上面的代码片段,我收到以下错误:
{{1}}
寻求帮助,如何将二进制数据提供给字节数组?
答案 0 :(得分:0)
您的blob_data
对象似乎实际上不包含字节。你可以调试它来打印该循环中的字节,并确保它适合[0,255]