{"action":"created","issue":{"url":"https://api.github.com/repos/eleme/gunicorn_thrift/issues/17","labels_url":"https://api.github.com/repos/eleme/gunicorn_thrift/issues/17/labels{/name}","comments_url":"https://api.github.com/repos/eleme/gunicorn_thrift/issues/17/comments","events_url":"https://api.github.com/repos/eleme/gunicorn_thrift/issues/17/events","html_url":"https://github.com/eleme/gunicorn_thrift/issues/17","id":103832100,"number":17,"title":"请问是否支持TMultiplexedProcessor？","user":{"login":"caiqingmao","id":7111656,"avatar_url":"https://avatars.githubusercontent.com/u/7111656?v=3","gravatar_id":"","url":"https://api.github.com/users/caiqingmao","html_url":"https://github.com/caiqingmao","followers_url":"https://api.github.com/users/caiqingmao/followers","following_url":"https://api.github.com/users/caiqingmao/following{/other_user}","gists_url":"https://api.github.com/users/caiqingmao/gists{/gist_id}","starred_url":"https://api.github.com/users/caiqingmao/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/caiqingmao/subscriptions","organizations_url":"https://api.github.com/users/caiqingmao/orgs","repos_url":"https://api.github.com/users/caiqingmao/repos","events_url":"https://api.github.com/users/caiqingmao/events{/privacy}","received_events_url":"https://api.github.com/users/caiqingmao/received_events","type":"User","site_admin":false},"labels":[],"state":"open","locked":false,"assignee":null,"milestone":null,"comments":3,"created_at":"2015-08-29T06:11:28Z","updated_at":"2015-08-30T16:10:26Z","closed_at":null,"body":"写了一个thrift文件 \r\nservice PingPong {\r\n    string ping()\r\n}\r\nservice Hello{\r\n    string hello2015()\r\n}\r\n\r\n然后使用thriftpy\r\n\r\nimport thriftpy\r\nfrom thriftpy.thrift import TProcessor\r\nfrom thriftpy.thrift import TMultiplexedProcessor\r\n\r\n\r\nclass PingPongDispatcher(object):\r\n    def ping(self):\r\n        return \"pong\"\r\n\r\n\r\nclass HelloDispatcher(object):\r\n    def hello2015(self):\r\n        return \"hello2015\"\r\n\r\n\r\npingpong_thrift = thriftpy.load(\"pingpong.thrift\")\r\napp1 = TProcessor(pingpong_thrift.PingPong, PingPongDispatcher())\r\napp2 = TProcessor(pingpong_thrift.Hello, HelloDispatcher())\r\nprocessor = TMultiplexedProcessor()\r\nprocessor.register_processor(\"pingpong\", app1)\r\nprocessor.register_processor(\"hello\", app2)\r\n\r\n\r\n然后使用gunicorn_thrift启动\r\ngunicorn_thrift app:processor -k thrift_gevent --thrift-protocol-factory thriftpy.protocol:TBinaryProtocolFactory --thrift-transport-factory thriftpy.transport:TBufferedTransportFactory --error-log -\r\n\r\n客户端使用的是java、访问python服务器端时出现错误\r\n\r\n[2015-08-29 14:09:49 +0800] [719] [ERROR] 'TCyBufferedTransportFactory' object has no attribute 'getTransport'\r\nTraceback (most recent call last):\r\n  File \"/Library/Python/2.7/site-packages/gunicorn_thrift/gevent_worker.py\", line 42, in handle\r\n    self.get_thrift_transports_and_protos(result)\r\n  File \"/Library/Python/2.7/site-packages/gunicorn_thrift/gevent_worker.py\", line 25, in get_thrift_transports_and_protos\r\n    itrans = self.app.tfactory.getTransport(result)\r\nAttributeError: 'TCyBufferedTransportFactory' object has no attribute 'getTransport'\r\nTraceback (most recent call last):\r\n  File \"/Library/Python/2.7/site-packages/gevent/greenlet.py\", line 327, in run\r\n    result = self._run(*self.args, **self.kwargs)\r\n  File \"/Library/Python/2.7/site-packages/gunicorn_thrift/gevent_worker.py\", line 59, in handle\r\n    itrans.close()\r\nUnboundLocalError: local variable 'itrans' referenced before assignment\r\n<Greenlet at 0x104e74870: <functools.partial object at 0x104ea4ec0>(<socket at 0x104f24750 fileno=11 sock=127.0.0.1:80, ('127.0.0.1', 49831))> failed with UnboundLocalError\r\n\r\n\r\n请问这是怎么回事？本人新手学习thriftpy和使用gunicorn_thrift、跪请大神回复\r\n\r\n\r\n\r\n"},"comment":{"url":"https://api.github.com/repos/eleme/gunicorn_thrift/issues/comments/136156414","html_url":"https://github.com/eleme/gunicorn_thrift/issues/17#issuecomment-136156414","issue_url":"https://api.github.com/repos/eleme/gunicorn_thrift/issues/17","id":136156414,"user":{"login":"wooparadog","id":1130984,"avatar_url":"https://avatars.githubusercontent.com/u/1130984?v=3","gravatar_id":"","url":"https://api.github.com/users/wooparadog","html_url":"https://github.com/wooparadog","followers_url":"https://api.github.com/users/wooparadog/followers","following_url":"https://api.github.com/users/wooparadog/following{/other_user}","gists_url":"https://api.github.com/users/wooparadog/gists{/gist_id}","starred_url":"https://api.github.com/users/wooparadog/starred{/owner}{/repo}","subscriptions_url":"https://api.github.com/users/wooparadog/subscriptions","organizations_url":"https://api.github.com/users/wooparadog/orgs","repos_url":"https://api.github.com/users/wooparadog/repos","events_url":"https://api.github.com/users/wooparadog/events{/privacy}","received_events_url":"https://api.github.com/users/wooparadog/received_events","type":"User","site_admin":false},"created_at":"2015-08-30T16:10:26Z","updated_at":"2015-08-30T16:10:26Z","body":"尝试升级一下 thriftpy 的版本吧. \r\n\r\nhttps://github.com/eleme/thriftpy/commit/40f97ec97b8fd0147332427a31317b20c24c99e2"}}