Beispiel #1
0
            uncompfile = open(
                config.ConfigManager().PCRatesFileFolder + '/' + filename,
                'wb')
            uncompfile.write(gzipdata)
            uncompfile.close()

        except BaseException as ex:
            utility.log_exception_file_and_filepath(
                ex,
                config.ConfigManager().PromptcloudLogFile, filepath)
        os.remove(filepath)


if __name__ == "__main__":
    utility.write_to_file(
        config.ConfigManager().PromptcloudLogFile, 'a',
        'promptcloud rates file unzip running' + ' ' +
        str(datetime.datetime.now()))
    compfile_paths = []
    compdirectory_list = []

    # putting all the folder names where file is downloaded to an array
    compdirectory_list = utility.string_to_array(
        config.ConfigManager().PCRatesCompFolder, ',', compdirectory_list)
    # getting all the paths of files
    compfile_paths = filemanager.directory_iterate(compdirectory_list)
    route_compfileread(compfile_paths)
    # archiving and deleting files so that they don't get read again
    # utility.archive_content(
    # compfile_paths, config.ConfigManager().ArchiveDirectory)
def all_filepath_dict_list(detection_dict_list_all, batchId, file_name):
    finalFlags = [2, 2, 2, 2, 2]
    detection_dict_all = create_dict(finalFlags, batchId, file_name)
    detection_dict_all["isSent"] = 1
    detection_dict_list_all.append(detection_dict_all)
    return detection_dict_list_all


if __name__ == "__main__":
    filepaths = []
    directory_list = []
    # print(config.ConfigManager().fileDirectory)
    directory_list = utility.string_to_array(
        config.ConfigManager().fileDirectory, ',', directory_list)
    filepaths = filemanager.directory_iterate(directory_list)
    detection_dict_list = []
    detection_dict_list_all = []

    for filepath in filepaths:
        strtimestamp = str(datetime.datetime.now())
        data_text = ''
        # flags = []
        filepath_mod = filepath.replace('\\', '!@#$%')
        file_batchId_name = utility.filename_from_filepath(filepath_mod)
        batchIdsupplierId = (file_batchId_name[1:]).split('_')[0]
        batchId = (batchIdsupplierId).split('-')[0]
        supplierId = int((batchIdsupplierId).split('-')[1])
        file_name = (file_batchId_name[1:]).split('_')[1]
        file_name = file_name.replace('!@#$%', '\\')
        try: