Setting Up Winutils for HDFS and Windows File System Integration



Having lunch pyspark successfully, I have got the following response when trying to validate

Traceback ( most recent call last):
File “”, line 1, in
AttributeError: ‘SparkContext’ object has no attribute ‘txtFile’

where could I have gone wrong please kindly assist.


Hi @Chris

Can you share the command what you have tried?



I am getting this erroneous output from pyspark application using pycharm
after running the code:
from pyspark import SparkConf, SparkContext

sc = SparkContext (master= “local”, appName= “Spark Demo”)

File “C:\Users\CHRIS\PycharmProjects\gettingstarted\venv\lib\”, line 425, in getitem
KeyError: ‘SPARK_HOME’

kindly assist.
Thank you


I am also confronted with creating

c:/hadoop/bin directory in C: for witusils…

how do go about the forward slash please?


Hi @Chris

To read the text file in spark we need to give as below so change your print function and let us know


Please follow this blog to Setup Spark Development Environment – PyCharm and Python

Sunil Abhishek


Thank you Sunil, it worked perfectly and the output was what i expected .
Besides I await your response to the pycharm request for please.

Concerning Ubuntu installation. I ran as administrator but same error message continues. it was initially running after launching but later changed to the red error message.
Kindly assist please.