Skip to content

Compiled version has permissions issue when attempting to delete memory map file on exit

Seems like the atexit.register(self.clean_swap_directory) finction fails to delete the .dat file from the swap at exit. I put in a time.sleep(3) delay to let the OS try and release the file handles, but that doesn't seem to work either. Probably need to explicitly enable unsafe delete from rmtree, or a better move would be to close the momory map explicitly (not sure how to do this from the scope of the atexit!

def cleanup_temp_directory(self):
    # This function will be called when the application exits
    if os.path.exists(self.swap_directory):
        # Close the memory map explicitly
        self.memory_map.close()