config.py 文件源码

python
阅读 22 收藏 0 点赞 0 评论 0

项目:tm 作者: tulians 项目源码 文件源码
def copy_menu():
    """Copies interactive menu to the executable directory."""
    menu_source_path = source_directory + "/menu.py"
    menu_bin_path = executable_directory + "/tm"
    try:
        if not os.path.exists(executable_directory):
            os.makedirs(executable_directory)
        # Create a new file 'tm' in the executable directory.
        copyfile(menu_source_path, menu_bin_path)
        # Make the file executable.
        st = os.stat(menu_bin_path)
        os.chmod(menu_bin_path, st.st_mode | stat.S_IEXEC)
        print("Menu successfully copied to {}.".format(executable_directory))
        return True
    except IOError as detail:
        print("Menu file could not be copied to {}. ".
              format(executable_directory) + str(detail))
        return False
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号