def archive_sketch(window, sketch_path):
    sketch_name = os.path.basename(sketch_path)
    console = st_console.Console(window, str(time.time()))
    message_queue = pyarduino.base.message_queue.MessageQueue(console)
    message_queue.put('Archive Sketch {0}...\\n', sketch_name)

    zip_file_name = sketch_name + '.zip'
    document_path = pyarduino.base.sys_path.get_document_path()
    zip_file_path = os.path.join(document_path, zip_file_name)
    os.chdir(sketch_path)
    sketch_dir = pyarduino.base.abs_file.Dir(sketch_path)
    files = sketch_dir.list_files()
    file_names = [f.get_name() for f in files]
    try:
        opened_zipfile = zipfile.ZipFile(zip_file_path,
                                         'w', zipfile.ZIP_DEFLATED)
    except __HOLE__:
        text = 'Archiving the sketch has been canceled because '
        text += "the sketch couldn't save properly.\\n"
        message_queue.put(text)
    else:
        for file_name in file_names:
            opened_zipfile.write(file_name)
        opened_zipfile.close()
        message_queue.put('Archive sketch as: {0}.\\n', zip_file_path)
    message_queue.print_screen(one_time=True)
dataset/ETHPy150Open Robot-Will/Stino/stino/main.py/archive_sketch