labpack/records/settings.py
def _remove_settings(_file_path, _retry_count=10, _remove_dir=False):

    '''
        a helper method for removing settings file
        
    :param _file_path: string with path to file to remove 
    :param _retry_count: integer with number of attempts before error is raised
    :param _remove_dir: [optional] boolean to remove empty parent directories
    :return: None
    '''

    import os
    from time import sleep

    count = 0
    while True:
        try:
            os.remove(_file_path)
            if _remove_dir:
                path_segments = os.path.split(_file_path)
                if len(path_segments) > 1:
                    file_folders = path_segments[0]
                    try:
                        os.removedirs(file_folders)
                    except:
                        pass
            break
        except PermissionError:
            sleep(.05)
            count += 1
            if count > _retry_count:
                raise

    os._exit(0)

        a helper method for removing settings file
        
    :param _file_path: string with path to file to remove 
    :param _retry_count: integer with number of attempts before error is raised
    :param _remove_dir: [optional] boolean to remove empty parent directories
    :return: None
    
a helper method for removing settings file
a helper method for removing settings file
def _remove_settings(_file_path, _retry_count=10, _remove_dir=False):
    import os
    from time import sleep
    count = 0
    while True:
        try:
            os.remove(_file_path)
            if _remove_dir:
                path_segments = os.path.split(_file_path)
                if len(path_segments) > 1:
                    file_folders = path_segments[0]
                    try:
                        os.removedirs(file_folders)
                    except:
                        pass
            break
        except PermissionError:
            sleep(.05)
            count += 1
            if count > _retry_count:
                raise
    os._exit(0)
def _remove_settings ( _file_path , _retry_count = 10 , _remove_dir = False ) : import os from time import sleep count = 0 while True : try : os . remove ( _file_path ) if _remove_dir : path_segments = os . path . split ( _file_path ) if len ( path_segments ) > 1 : file_folders = path_segments [ 0 ] try : os . removedirs ( file_folders ) except : pass break except PermissionError : sleep ( .05 ) count += 1 if count > _retry_count : raise os . _exit ( 0 )
a helper method for removing settings file
a helper method for removing settings file
'''
        a helper method for removing settings file
        
    :param _file_path: string with path to file to remove 
    :param _retry_count: integer with number of attempts before error is raised
    :param _remove_dir: [optional] boolean to remove empty parent directories
    :return: None
    '''
None
_file_path
string with path to file to remove
string with path to file to remove
_retry_count
integer with number of attempts before error is raised
integer with number of attempts before error is raised
_remove_dir
[optional] boolean to remove empty parent directories
[ optional ] boolean to remove empty parent directories