解决 pyspark 中调用 show() 函数报 UnicodeEncodeError 的问题
程序员文章站
2022-05-10 19:32:05
...
错误信息:
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
下一篇: 平时的笔记