Skip to content

Commit a11968b

Browse files
committed
fixed python style
1 parent 795ec27 commit a11968b

File tree

1 file changed

+8
-7
lines changed

1 file changed

+8
-7
lines changed

python/pyspark/streaming/mqtt.py

+8-7
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
#
1717

1818
from py4j.java_collections import MapConverter
19-
from py4j.java_gateway import java_import, Py4JError
19+
from py4j.java_gateway import java_import, Py4JJavaError
2020

2121
from pyspark.storagelevel import StorageLevel
2222
from pyspark.serializers import UTF8Deserializer
@@ -44,15 +44,16 @@ def createStream(ssc, brokerUrl, topic,
4444

4545
try:
4646
jstream = ssc._jvm.MQTTUtils.createStream(ssc._jssc, brokerUrl, topic, jlevel)
47-
except Py4JError, e:
48-
if 'ClassNotFoundException' in str(e.java_exception):
47+
except Py4JJavaError as e:
48+
if 'ClassNotFoundException' in str(e.java_exception):
4949
MQTTUtils._printErrorMsg(ssc.sparkContext)
5050
raise e
51+
5152
return DStream(jstream, ssc, UTF8Deserializer())
52-
53-
@staticmethod
54-
def _printErrorMsg(sc):
55-
print("""
53+
54+
@staticmethod
55+
def _printErrorMsg(sc):
56+
print("""
5657
________________________________________________________________________________________________
5758
5859
Spark Streaming's MQTT libraries not found in class path. Try one of the following.

0 commit comments

Comments
 (0)