微信公众号搜"智元新知"关注
微信扫一扫可直接关注哦!

Python Director

程序名称:Python Director

授权协议: 未知

操作系统: 跨平台

开发语言: Python

Python Director 介绍

Director 是一个Python的类库用来开发命令行工具的插件,利用它可以很方便的添加新的功能

下面是一个简单的例子:

#!/usr/bin/env python

import exceptions  
import sys

from director import ActionRunner  
from director.filter import ExceptionFilter  
from director.filter import Filter

if __name__ == '__main__':  
    # Create and use exception filters  
    # Note you don't have to use filters. If you don't pass filter in  
    # to ActionRunner.run filters won't be used.  
    filter = Filter()  
    filter.register_filter(ExceptionFilter(exceptions.IOError, "TEST %s"))  
    filter.register_filter(ExceptionFilter(exceptions.TypeError, "NO! %s"))

    # 'actions.package' is the package that holds the allowed plugin actions  
    ar = ActionRunner(sys.argv, 'actions.package')  
    ar.run(filter)

Python Director 官网

https://fedorahosted.org/director/

版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 [email protected] 举报,一经查实,本站将立刻删除。

相关推荐