Write permission denied - Udemy tutorials

Hi I am following the tutorials from Udemy Apache Spark 2.x – Data processing - Getting Started - Develop Simple Application

and when execute

Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/hdp/current/spark2-client/python/pyspark/sql/readwriter.py", line 885, in csv
    self._jwrite.csv(path)
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/java_gateway.py", line 1160, in __call__
  File "/usr/hdp/current/spark2-client/python/pyspark/sql/utils.py", line 63, in deco
    return f(*a, **kw)
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/protocol.py", line 320, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o382.csv.
: org.apache.hadoop.security.AccessControlException: Permission denied: user=XXXX, access=WRITE, inode="/user/training/df/wordcount/_temporary/0":training:training:drwxr-xr-x```


The same happens with ```>>> wc.map(lambda rec: rec[0] + ',' + str(rec[1]) ).saveAsTextFile('/user/training/core/wordcount')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/hdp/current/spark2-client/python/pyspark/rdd.py", line 1568, in saveAsTextFile
    keyed._jrdd.map(self.ctx._jvm.BytesToString()).saveAsTextFile(path)
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/java_gateway.py", line 1160, in __call__
  File "/usr/hdp/current/spark2-client/python/pyspark/sql/utils.py", line 63, in deco
    return f(*a, **kw)
  File "/usr/hdp/current/spark2-client/python/lib/py4j-0.10.6-src.zip/py4j/protocol.py", line 320, in get_return_value
py4j.protocol.Py4JJavaError: An error occurred while calling o295.saveAsTextFile.
: org.apache.hadoop.security.AccessControlException: Permission denied: user=XXXX, access=WRITE, inode="/user/training/core/wordcount/_temporary/0":training:training:drwxr-xr-x```

Please help

@Andreas_Alamanos Error is clearly saying your trying with /user/training/ path, you don’t have permission on that path. try with your userid in place of training. If the issue still persists, share your code someone can help you with code in this community.