【发布时间】:2014-11-02 01:50:28
【问题描述】:
这是我的twistd插件的当前状态,位于project_root/twisted/plugins/my_plugin.py:
#!/usr/bin/env python
# -*- coding: utf-8 -*-
from zope.interface import implements
from twisted.plugin import IPlugin
from twisted.python.usage import Options
from twisted.application import internet, service
from mylib.io import MyFactory
class Options(Options):
"""Flags and options for the plugin."""
optParameters = [
('sock', 's', '/tmp/io.sock', 'Path to IO socket'),
]
class MyServiceMaker(object):
implements(service.IServiceMaker, IPlugin)
tapname = "myplugin"
description = "description for my plugin"
options = Options
def makeService(self, options):
return internet.UNIXServer(options['sock'], MyFactory())
-
project_root/twisted/plugins/中有 no__init__.py文件 -
twistd从项目根目录运行时,输出不显示我的插件 - 我通过
python setup.py develop --user安装了我的库,它可以从任何地方导入
有什么想法吗?
【问题讨论】: