Skip to content

Commit 7b96e97

Browse files
committed
address comments from @HyukjinKwon
1 parent 273c1bc commit 7b96e97

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

python/pyspark/sql/utils.py

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,10 @@
1616
#
1717

1818
import py4j
19+
import sys
20+
21+
if sys.version > '3':
22+
unicode = str
1923

2024

2125
class CapturedException(Exception):
@@ -24,7 +28,11 @@ def __init__(self, desc, stackTrace):
2428
self.stackTrace = stackTrace
2529

2630
def __str__(self):
27-
return str(self.desc)
31+
desc = self.desc
32+
if isinstance(desc, unicode):
33+
return str(desc.encode('utf-8'))
34+
else:
35+
return str(desc)
2836

2937

3038
class AnalysisException(CapturedException):

0 commit comments

Comments
 (0)