问题描述:

I have trouble transferring the blob_name to my queue so I can read out the information there and process it. The information or content of the Blob is basically just a list of text (CSV). I also tried this with the blob_key, but both result in the same error.

# 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

This is the error I am receiving:

TypeError: object of type 'BlobReader' has no len()

网友答案:

Looks like you forgot the specify the the blob_key name parameter. Try this:

blob_key = files.blobstore.get_blob_key(blob_key = str(lowkey))
相关阅读:
Top