Uploaded image for project: 'Flink'
  1. Flink
  2. FLINK-9927

Error in Python Stream API example on website

    XMLWordPrintableJSON

    Details

      Description

      The Python Programming Guide (Streaming) page contains a WordCount example with the following main method:

      def main(factory):
       env = factory.get_execution_environment()
       env.create_python_source(Generator(num_iters=1000)) \
       .flat_map(Tokenizer()) \
       .key_by(Selector()) \
       .time_window(milliseconds(50)) \
       .reduce(Sum()) \
       .print()

      The print() should, according to the documentation, be output(). Trying to call print() results in an error:

      jmalt-machine:bin jmalt$ ./pyflink-stream.sh /Users/jmalt/flink-python/WordCount.py
      Starting execution of program
      Failed to run plan: null
      Traceback (most recent call last):
       File "<string>", line 1, in <module>
       File "/var/folders/t1/gcltcjcn5zdgqfqrc32xk90x85xkg9/T/flink_streaming_plan_9539e241-ba0a-42bf-9d4c-844dda26b998/WordCount.py", line 43, in main
      AttributeError: 'org.apache.flink.streaming.python.api.datastream.P' object has no attribute 'print'

        Attachments

          Issue Links

            Activity

              People

              • Assignee:
                Unassigned
                Reporter:
                joemalt Joe Malt
              • Votes:
                0 Vote for this issue
                Watchers:
                2 Start watching this issue

                Dates

                • Created:
                  Updated:
                  Resolved: