2014-11-02 3 views
2
여기

project_root/twisted/plugins/my_plugin.py에 위치한 내 twistd 플러그인의 현재 상태 :옵션없이`twistd` 명령을 실행하면 트위스트 된 플러그인이 나타나지 않는 이유는 무엇입니까?

twistd의 출력은 내 플러그인 때 표시되지 않습니다 project_root/twisted/plugins/
  • 에는__init__.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()) 
    
    • 프로젝트의 루트 디렉토리에서 실행하십시오.
    • python setup.py develop --user을 통해 라이브러리를 설치했으며 어디서나 가져올 수 있습니다.

    아이디어가 있으십니까? 그래서 단순히 스크립트의 맨 아래에 service_maker = MyServiceMaker()를 추가하는 문제를 해결, 내가 MyServiceMaker의 인스턴스를 인스턴스화하는 데 필요한 :

    의심으로
  • 답변

    2

    , 그것은 매우 간단한 것이었다.

    +0

    나는 똑같은 문제가있다. 그러나 나는 네가 한 일을 잊지 않았다. – rschwieb