Uploaded image for project: 'Thrift'
  1. Thrift
  2. THRIFT-4089

Several issues with generated Python code: TFrozenDict, _fast_encode

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Information Provided
    • 0.10.0
    • None
    • Python - Compiler
    • None
    • Python 2.7, 3.5. OS-X

    Description

      When you generate Python sources for a simple thrift file (e.g. Thrift tutorial from https://thrift.apache.org/tutorial/py will also repro erros), errors are thrown while running the PythonServer and PythonClient.

      1. When running the vanilla PythonServer, I get the following error:

      File "gen-py/shared/SharedService.py", line 9, in <module>
      from thrift.Thrift import TType, TMessageType, TFrozenDict, TException, TApplicationException
      ImportError: cannot import name TFrozenDict

      I see this error consistently for all generated thrift files. The error disappears on removing TFrozenDict from the generated files (it is not used anywhere in the file).

      2. When running the vanilla PythonClient (the server is now running after the above fix), I get the following error:

      File "PythonClient.py", line 51, in main
      client.ping()
      File "gen-py/tutorial/Calculator.py", line 73, in ping
      self.send_ping()
      File "gen-py/tutorial/Calculator.py", line 79, in send_ping
      args.write(self._oprot)
      File "gen-py/tutorial/Calculator.py", line 297, in write
      if oprot._fast_encode is not None and self.thrift_spec is not None:
      AttributeError: TBinaryProtocol instance has no attribute '_fast_encode'

      I am not sure why this error is being thrown/what can be done to fix it.

      These two errors, and mainly the latter one, are rendering the Server/Client un-usable. Is this a known issue? And how do you recommend working around it?

      Attachments

        Activity

          People

            Unassigned Unassigned
            mvartak Manasi Vartak
            Votes:
            0 Vote for this issue
            Watchers:
            3 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: