我正在尝试使用Google Cloud pubsub仿真器实现pubsub类。
我在使用Python的Docker上这样做,它基于Flask。
当我使用需求文件安装Google Cloud SDK时,一切正常,但是,当我尝试使用pipenv
时,出现标题中提到的错误,而且我不知道该怎么办。
原始输出如下所示:
Unexpected error:<type 'exceptions.TypeError'>
Traceback (most recent call last):
File "app.py", line 18, in <module>
pubsub.init()
File "/app/pubsub.py", line 85, in init
subscription = subscriber.subscribe(subscription_name, callback)
File "/usr/local/lib/python2.7/site-packages/google/cloud/pubsub_v1/subscriber/client.py", line 139, in subscribe
subscr = self._policy_class(self, subscription, flow_control)
File "/usr/local/lib/python2.7/site-packages/google/cloud/pubsub_v1/subscriber/policy/thread.py", line 90, in __init__
self._executor = self._get_executor(executor)
File "/usr/local/lib/python2.7/site-packages/google/cloud/pubsub_v1/subscriber/policy/thread.py", line 134, in _get_executor
**executor_kwargs
TypeError: __init__() got an unexpected keyword argument 'thread_name_prefix'
这是创建基础映像(然后用作应用程序基础)的Dockerfile:
FROM python:2.7-alpine
RUN set -x && apk add --no-cache build-base && pip install pipenv
WORKDIR /api
COPY Pipfile ./
COPY Pipfile.lock ./
RUN set -ex && pipenv install --deploy --system
顺便说一句,当我在RUN pip install google.cloud.pubsub
之后执行pipenv install
时,它确实起作用了,因此它确实与pipenv
有关。
感谢您的帮助:)