Skip to content

Commit

Permalink
[SPARK-12960] [PYTHON] Some examples are missing support for python2
Browse files Browse the repository at this point in the history
Without importing the print_function, the lines later on like ```print("Usage: direct_kafka_wordcount.py <broker_list> <topic>", file=sys.stderr)``` fail when using python2.*. Import fixes that problem and doesn't break anything on python3 either.

Author: Mark Grover <[email protected]>

Closes apache#10872 from markgrover/python2_compat.
  • Loading branch information
markgrover authored and davies committed Jan 22, 2016
1 parent 55c7dd0 commit 006906d
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 0 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,7 @@
examples/src/main/python/streaming/direct_kafka_wordcount.py \
localhost:9092 test`
"""
from __future__ import print_function

import sys

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@
See http://spark.apache.org/docs/latest/streaming-kinesis-integration.html for more details on
the Kinesis Spark Streaming integration.
"""
from __future__ import print_function

import sys

from pyspark import SparkContext
Expand Down

0 comments on commit 006906d

Please sign in to comment.