0

I would like read a file from HDFS using Python open() method . However it is not working. Can someone give me a method to read hdfs file using Open() method in python.

for line in open("hdfs://namenode:54311/user/hadoop/filename.txt"):

However it gives me an error

"IOError: [Errno 2] No such file or directory: 'hdfs://namenode:54311/user/hadoop/filename.txt'"

Noel Evans
  • 8,113
  • 8
  • 48
  • 58
  • 1
    possible duplicate of [Python read file as stream from HDFS](http://stackoverflow.com/questions/12485718/python-read-file-as-stream-from-hdfs) – rchang Jan 22 '15 at 19:10

1 Answers1

1

The built in open doesn't work with URIs. E.g. It would also error out on open("http://example.com/index.html").

Your question is well answered in the suggested duplicate.

serverhorror
  • 779
  • 5
  • 21