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'"

1

1 Answer 1

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.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.