小编Nat*_*WCC的帖子

Google Cloud Tasks ImportError:无法导入名称“ resource_pb2”

尝试使用google提供的python示例代码将任务添加到Google Cloud Tasks队列。谷歌的文档在这里:https : //cloud.google.com/tasks/docs/creating-appengine-tasks

当我尝试执行端点时,出现以下错误:

ImportError:无法导入名称“ resource_pb2”

有没有人看到过类似的问题,并且知道如何解决这个问题?

在此先感谢您的时间 :)

-内森

我尝试将google-cloud-tasks,google-api,google-cloud添加到我的requirements.txt中,并在我的虚拟环境中运行pip install google-cloud-tasks。我也尝试使用此代码:

从google.cloud导入task_v2beta3

结果是一样的

这是谷歌提供的示例代码。我已向他们发送了一条便条,以使他们知道示例代码不起作用。

from google.cloud import tasks_v2
from google.protobuf import timestamp_pb2

# Create a client.
client = tasks_v2.CloudTasksClient()

# TODO(developer): Uncomment these lines and replace with your values.
# project = 'my-project-id'
# queue = 'my-appengine-queue'
# location = 'us-central1'
# payload = 'hello'

# Construct the fully qualified queue name.
parent = client.queue_path(project, location, queue)

# Construct the request body.
task = { …
Run Code Online (Sandbox Code Playgroud)

python google-app-engine google-cloud-tasks

2
推荐指数
1
解决办法
321
查看次数