S3的Python getsize问题

时间:2018-08-14 08:47:34

标签: python amazon-s3 hdfs

我正在尝试使用S3 bucket检查我们getsize上的备份文件。 我认为无法将此功能与s3 wrapper一起使用。

还有其他选择吗?

这是我的代码:

def check_created_file(self,destination) :
    if destination != None  : 
        files = os.popen("hdfs dfs -ls %s | awk {'print $8'}"%(destination)).read().split("\n")
        files = files[1::len(files)-1]
        for file in files : 
            if  os.path.getsize(file) >  0  :
                print file 
            else: 
                print " [*] WARNING "
                print "%s is empty"%(file)
    else: 
        raise Exception("Remote dir is not specified")

我得到的错误:

OSError: [Errno 2] No such file or directory

0 个答案:

没有答案