Skip to content

Commit

Permalink
Use _exception_message() to access error messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
ueshin committed Nov 21, 2017
1 parent 3db2bea commit 3e23653
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion python/pyspark/sql/dataframe.py
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,7 @@
from pyspark.sql.streaming import DataStreamWriter
from pyspark.sql.types import IntegralType
from pyspark.sql.types import *
from pyspark.util import _exception_message

__all__ = ["DataFrame", "DataFrameNaFunctions", "DataFrameStatFunctions"]

Expand Down Expand Up @@ -1902,7 +1903,7 @@ def toPandas(self):
except ImportError as e:
msg = "note: pyarrow must be installed and available on calling Python process " \
"if using spark.sql.execution.arrow.enabled=true"
raise ImportError("%s\n%s" % (e.message, msg))
raise ImportError("%s\n%s" % (_exception_message(e), msg))
else:
pdf = pd.DataFrame.from_records(self.collect(), columns=self.columns)

Expand Down
3 changes: 2 additions & 1 deletion python/pyspark/sql/types.py
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@

from pyspark import SparkContext
from pyspark.serializers import CloudPickleSerializer
from pyspark.util import _exception_message

__all__ = [
"DataType", "NullType", "StringType", "BinaryType", "BooleanType", "DateType",
Expand Down Expand Up @@ -1682,7 +1683,7 @@ def _old_pandas_exception_message(e):
""" Create an error message for importing old Pandas.
"""
msg = "note: Pandas (>=0.19.2) must be installed and available on calling Python process"
return "%s\n%s" % (e.message, msg)
return "%s\n%s" % (_exception_message(e), msg)


def _check_dataframe_localize_timestamps(pdf, timezone):
Expand Down

0 comments on commit 3e23653

Please sign in to comment.