我无法将 blob_name 传输到我的队列,因此我可以在那里读出信息并进行处理。Blob 的信息或内容基本上只是一个文本列表 (CSV)。我也用 blob_key 试过这个,但都导致同样的错误。
# I create the blob - works fine, checked in Dashboard
file_name = files.blobstore.create(mime_type='text/comma-separated-values',_blobinfo_uploaded_filename=str(datetime.now()))
with files.open(file_name, 'a') as f:
f.write(low)
files.finalize(file_name)
# Transferring the variables to the queue
taskqueue.add(url='/filtering_brands', params={'filter_name' : filter_name, 'user' : user, 'lowkey' : file_name})
self.redirect('/?sent=True')
class Queue(webapp2.RequestHandler):
def post(self):
# Requesting the variables
filter_name = self.request.get('filter_name')
user = self.request.get('user')
lowkey = self.request.get('lowkey')
blob_key = files.blobstore.get_blob_key(lowkey)
# This is (apparently) the part that doesn't work
low = blobstore.BlobReader(blob_key)
# Process the data and transfer it to an email script
这是我收到的错误:
TypeError: object of type 'BlobReader' has no len()