Reading Text File from Local File System in Lab

apache-spark

#1

products = open("/data/retail_db/products/part-00000.txt").read()
Traceback (most recent call last):
File “”, line 1, in
IOError: [Errno 2] No such file or directory: ‘/data/retail_db/products/part-00000.txt’

Can anyone suggest what’s wrong in the code, i was not able to open files from local file system


#2

Just Use “/data/retail_db/products/part-00000” instead of ‘/data/retail_db/products/part-00000.txt’