python snakebite模块ls返回错误没有这样的文件或目录

时间:2018-06-07 05:37:20

标签: python hadoop hdfs snakebite

在snakebite python模块尝试递归ls时,在下面的目录中,不返回这样的文件或目录。

mybox]$ hdfs dfs -ls /data/tdc/dv1/corp/base/dpp/raw/load_date=2018-05-01/ | grep Tenant
drwxr-xr-x   - tdcdv1r tdcdv1c          0 2018-05-01 18:28 /data/tdc/dv1/corp/base/dpp/raw/load_date=2018-05-01/rtng_ky=Access.NBNOrder.Amend.Info.{Tenant}.Rejected.v2.event
drwxr-xr-x   - tdcdv1r tdcdv1c          0 2018-05-01 15:35 /data/tdc/dv1/corp/base/dpp/raw/load_date=2018-05-01/rtng_ky=Access.NBNOrder.Amend.Info.{Tenant}.v2.event

我知道它归因于{}特殊字符,但是蛇咬伤无法处理它,是否有任何解决此问题的方法?

下面是python代码:

from snakebite.client import HAClient
from snakebite.namenode import Namenode
name_node_list = [Namenode('namenode-01.localhost.com', 8020),
Namenode('namenode-02.localhost.com', 8020)]
hdfs_namenode_principal = 'nn/namenode-01.localhost.com@localhost.com'
client = HAClient(name_node_list, use_trash=False, use_sasl=True, hdfs_namenode_principal=hdfs_namenode_principal)
for x in client.ls([path], recurse=True):
    print x

0 个答案:

没有答案