samy mustek
samy mustek

Reputation: 71

Write pyspark dataframe into s3 - An error occurred while calling o135.json

I have a DataFrame and I'd like to save the results as CSV inside my s3 directory called mydirectory : s3n://bucket/home/mydirectory/result.csv

In mydirectory I have the right to read and write.

However I have this error :

File "C:\Users\rubeno\Documents\spark-2.1.0-bin-hadoop2.7\python\lib\py4j-0.10.4-src.zip\py4j\protocol.py", line 319, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o135.json.
: org.apache.hadoop.security.AccessControlException: Permission denied: s3n://bucket/home

Here is my code to write and save the df program_watched_by_set_of_box

program_watched_by_set_of_box.write.save(path='s3n://bucket/home/mydirectory/result.csv',
                         format='com.databricks.spark.csv',
                         header='false',
                         nullValue='null',
                         mode='overwrite')

Thx

Upvotes: 2

Views: 1729

Answers (1)

vikrame
vikrame

Reputation: 485

check EMR configurations if fs.s3.enableServerSideEncryption is set to True. You can set below option with emr create-custer

--configurations '[{"Classification":"emrfs-site","Properties":{"fs.s3.enableServerSideEncryption":"true"},"Configurations":[]}]'

Upvotes: 1

Related Questions