这是我的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())
- 里面没有
__init__.py
文件project_root/twisted/plugins/
- 从项目的根目录运行时,输出
twistd
不显示我的插件 - 我通过安装我的库
python setup.py develop --user
,它可以从任何地方导入
有任何想法吗?