我想创建端点以列出路径的所有目录和文件。我正在使用hadoop hdfs库,django,python作为后端

时间:2016-08-20 06:55:48

标签: python django hadoop hdfs

我在views.py文件中尝试以下代码:

def list_of_files(request):
    obj = Hdfs()
    hdfs_path = obj.abspath(path)
    hd = obj.listdir_recursive(hdfs_path)
    i=iter(hd)
    print i.next()
    return path

并收到以下错误:

[19/Aug/2016 23:50:24 +0000] middleware   INFO     Processing exception: isdir() takes exactly 1 argument (2 given): Traceback (most recent call last):
  File "/home/dm10/Desktop/akira/akiradatabench-backend/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/core/handlers/base.py", line 112, in get_response
    response = wrapped_callback(request, *callback_args, **callback_kwargs)
  File "/home/dm10/Desktop/akira/akiradatabench-backend/build/env/local/lib/python2.7/site-packages/Django-1.6.10-py2.7.egg/django/db/transaction.py", line 371, in inner
    return func(*args, **kwargs)
  File "/home/dm10/Desktop/akira/akiradatabench-backend/apps/finder/src/finder/views.py", line 43, in list_of_files
    print i.next()
  File "/home/dm10/Desktop/akira/akiradatabench-backend/desktop/libs/hadoop/src/hadoop/fs/hadoopfs.py", line 233, in listdir_recursive
    if self.isdir(path):
TypeError: isdir() takes exactly 1 argument (2 given)

0 个答案:

没有答案