0

我无法将 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()
4

1 回答 1

1

看起来您忘记了指定 blob_key 名称参数。尝试这个:

blob_key = files.blobstore.get_blob_key(blob_key = str(lowkey))
于 2013-04-23T14:28:30.490 回答