def exists ( self , path ) : import hdfs try : self . client . status ( path ) return True except hdfs . util . HdfsError as e : if str ( e ) . startswith ( 'File does not exist: ' ) : return False else : raise e
python hdfs detect file exist
Returns true if the path exists and false otherwise .
def exists(self, path):
        """
        Returns true if the path exists and false otherwise.
        """
        import hdfs
        try:
            self.client.status(path)
            return True
        except hdfs.util.HdfsError as e:
            if str(e).startswith('File does not exist: '):
                return False
            else:
                raise e