Skip to content

Commit 106774a

Browse files
committed
fixed issue in listdir
1 parent ad30452 commit 106774a

File tree

3 files changed

+9
-5
lines changed

3 files changed

+9
-5
lines changed

webhdfs/VERSION

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1 +1 @@
1-
0.1.05
1+
0.1.06

webhdfs/example.py

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
from webhdfs.webhdfs import WebHDFS
1+
from webhdfs import WebHDFS
22
import os, tempfile
33
import time
44

@@ -19,7 +19,7 @@
1919
webhdfs.copyToLocal("/hello-world/test.txt",
2020
"/tmp/test1.txt")
2121

22-
for i in webhdfs.listdir("/"):
22+
for i in webhdfs.listdir("/hello-world/"):
2323
print str(i)
2424

25-
f.close()
25+
f.close()

webhdfs/webhdfs.py

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -127,7 +127,11 @@ def listdir(self, path):
127127
response = httpClient.getresponse()
128128
logger.debug("HTTP Response: %d, %s"%(response.status, response.reason))
129129
data_dict = json.loads(response.read())
130-
files = [i["localName"] for i in data_dict["HdfsFileStatus"]]
130+
logger.debug("Data: " + str(data_dict))
131+
files=[]
132+
for i in data_dict["FileStatuses"]["FileStatus"]:
133+
logger.debug(i["type"] + ": " + i["pathSuffix"])
134+
files.append(i["pathSuffix"])
131135
httpClient.close()
132136
return files
133137

0 commit comments

Comments
 (0)