3
私はgrpcの基本を習得しようとしていますが、this appengine docの例を使用すると、以下のエラーが発生します。私は新鮮なvirtualenvで、MacでPython 2.7.11
を使用しています。Googleのprotorpcが壊れています(メタクラスエラー)
私は1つのエラーを取得protorpc
とsix
の最新バージョンを使用して、ウェブ上で他人により示唆されるように、この問題をグーグルとき、バージョン1.10.0
へsix
をダウングレードするとき、私は別のエラーを取得します。両方のエラーが以下に示されています。 (DOCから直接コピー)hello.pyファイルの
内容最新ピップモジュールを実行
from protorpc import messages
from protorpc import remote
from protorpc.wsgi import service
package = 'hello'
class HelloRequest(messages.Message):
my_name = messages.StringField(1, required=True)
class HelloResponse(messages.Message):
hello = messages.StringField(1, required=True)
class HelloService(remote.Service):
@remote.method(HelloRequest, HelloResponse)
def hello(self, request):
return HelloResponse(hello='Hello there, %s!' % request.my_name)
# Map the RPC service and path (/hello)
app = service.service_mappings([('/hello.*', HelloService)])
(バージョンは、以下に示す):
$ pip freeze
protorpc==0.11.1
six==1.11.0
$ python hello.py
Traceback (most recent call last):
File "hello.py", line 1, in <module>
from protorpc import messages
File "/tmp/grpc/lib/python2.7/site-packages/protorpc/messages.py", line 1146, in <module>
class Field(six.with_metaclass(_FieldMeta, object)):
TypeError: Error when calling the metaclass bases
metaclass conflict: the metaclass of a derived class must be a (non-strict) subclass of the metaclasses of all its bases
格下げで実行six
モジュール(下のバージョン):
$ pip freeze
protorpc==0.11.1
six==1.10.0
$ python hello.py
Traceback (most recent call last):
File "hello.py", line 2, in <module>
from protorpc import remote
File "/tmp/grpc/lib/python2.7/site-packages/protorpc/remote.py", line 117, in <module>
from . import protobuf
File "/tmp/grpc/lib/python2.7/site-packages/protorpc/protobuf.py", line 41, in <module>
from .google_imports import ProtocolBuffer
ImportError: cannot import name ProtocolBuffer
バージョンの魔法の組み合わせがこの例の動作になるか、または私が次のドキュメントが古くて間違っている可能性がありますか?
ご意見ありがとうございます。
おかげクレイグが、そのはまだエラーメッセージが表示されて私のために失敗: –
2つの関連するコメント「はImportErrorは、名前ProtocolBufferをインポートすることはできません」: 1. 'remote'モジュールは、まだいくつかの問題を持っているようはい、それが見えます。 2. grpcとprotorpcは本物の関係がないことに注意してください。 –