Beispiel #1
0
    def getFile(self, path):
        """Load the file into the contents list.

        Args:
            file_path (str): path to the required file. 
        
        Returns:
            True if loaded ok, False otherwise.
        """
        logger.debug('loading File: ' + path)
        try:
            raw_contents = filetools.getFile(path)
        except IOError:
            logger.error('IOError - Unable to load file')
            return False

        if (raw_contents == None):
            logger.error('model file is empty at: ' + path)
            return False

        return raw_contents
Beispiel #2
0
    def __loadFile(self, filepath):
        """Load the .dat file into the contents list.
        
        Args:
            filepath: Path to the required DAT file.
            
        Returns:
            True if loaded ok, False otherwise.
        """
        logger.info('loading File: ' + filepath)
        try:
            self.contents = ftools.getFile(filepath)
        except IOError:
            logger.error('IOError - Unable to load file')
            return False

        if (self.contents == None):
            logger.error('.DAT file is empty at: ' + filepath)
            return False

        return True
Beispiel #3
0
 def __loadFile(self, filepath): 
     """Load the .dat file into the contents list.
     
     Args:
         filepath: Path to the required DAT file.
         
     Returns:
         True if loaded ok, False otherwise.
     """
     logger.info('loading File: ' + filepath)
     contents = []
     try: 
         contents = ftools.getFile(filepath);
     except IOError: 
         logger.error('IOError - Unable to load file')
         return False
         
     if(contents == None): 
         logger.error('.DAT file is empty at: ' + filepath)
         return False
     
     return contents
Beispiel #4
0
    def getFile(self, path):
        """Load the file into the contents list.

        Args:
            file_path (str): path to the required file. 
        
        Returns:
            True if loaded ok, False otherwise.
        """
        logger.debug('loading File: ' + path)
        try: 
            raw_contents = filetools.getFile(path)
        except IOError: 
            logger.error('IOError - Unable to load file')
            return False
            
        if(raw_contents == None): 
            logger.error('model file is empty at: ' + path)
            return False
                
        return raw_contents
        
Beispiel #5
0
def _loadFileFromDisc(path):
    """Load the file at the given path.
    
    Args:
        path(string): the absolute path to the file to load.
    
    Return:
        list containing the contents of the loaded file by line.
    
    Raises:
        IOError: if the file could not be loaded for some reason.
   """
    contents = []
    try:
        logger.info('Loading file contents from disc')
        contents = filetools.getFile(path)

    except IOError:
        logger.warning('ADataFileComponent cannot load file - IOError')
        raise

    return contents
Beispiel #6
0
def _loadFileFromDisc(path):
    """Load the file at the given path.
    
    Args:
        path(string): the absolute path to the file to load.
    
    Return:
        list containing the contents of the loaded file by line.
    
    Raises:
        IOError: if the file could not be loaded for some reason.
   """ 
    contents = []
    try:
        logger.info('Loading file contents from disc')
        contents = filetools.getFile(path)
                    
    except IOError:
        logger.warning('ADataFileComponent cannot load file - IOError')
        raise 
    
    return contents 
Beispiel #7
0
    def _loadFile(self, filepath):
        """Load the .ief file into the contents list.

        Args:
            filepath (str): Path to the required IEF file.

        Returns:
            The file contents as a list if loaded ok; False otherwise.
        """
        logger.info('loading File: ' + filepath)
        contents = None
        try:
            contents = filetools.getFile(filepath)
            return contents
        except IOError:
            logger.error('IOError - Unable to load file')
            return False

        if (contents == None or contents == ''):
            logger.error('.ief file is empty at: ' + filepath)
            return False

        return contents