解决 pyspark 中调用 show() 函数报 Unicod
2017-01-20 本文已影响0人
许伦
错误信息:
Traceback (most recent call last):
File "/data/app/ald_spark/aldstat_daily.py", line 177, in <module>
calc_convert_rate3(spark)
File "/data/app/ald_spark/aldstat_daily.py", line 77, in calc_convert_rate3
event_logs_df.show();
File "/data/app/ald_spark/spark/python/lib/pyspark.zip/pyspark/sql/dataframe.py", line 287, in show
UnicodeEncodeError: 'ascii' codec can't encode characters in position 822-825: ordinal not in range(128)
解决方法,提交脚本之前,设置环境变量:
export PYTHONIOENCODING=utf8