Skip to content

Commit

Permalink
fixed python style
Browse files Browse the repository at this point in the history
  • Loading branch information
prabeesh committed Jul 4, 2015
1 parent 795ec27 commit a11968b
Showing 1 changed file with 8 additions and 7 deletions.
15 changes: 8 additions & 7 deletions python/pyspark/streaming/mqtt.py
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
#

from py4j.java_collections import MapConverter
from py4j.java_gateway import java_import, Py4JError
from py4j.java_gateway import java_import, Py4JJavaError

from pyspark.storagelevel import StorageLevel
from pyspark.serializers import UTF8Deserializer
Expand Down Expand Up @@ -44,15 +44,16 @@ def createStream(ssc, brokerUrl, topic,

try:
jstream = ssc._jvm.MQTTUtils.createStream(ssc._jssc, brokerUrl, topic, jlevel)
except Py4JError, e:
if 'ClassNotFoundException' in str(e.java_exception):
except Py4JJavaError as e:
if 'ClassNotFoundException' in str(e.java_exception):
MQTTUtils._printErrorMsg(ssc.sparkContext)
raise e

return DStream(jstream, ssc, UTF8Deserializer())
@staticmethod
def _printErrorMsg(sc):
print("""

@staticmethod
def _printErrorMsg(sc):
print("""
________________________________________________________________________________________________
Spark Streaming's MQTT libraries not found in class path. Try one of the following.
Expand Down

0 comments on commit a11968b

Please sign in to comment.