yapsy无法正确加载插件 [英] yapsy doesn't load plugin correctly

查看:80
本文介绍了yapsy无法正确加载插件的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我正在使用yapsy开发python应用程序.

I am using yapsy for a python apps.

我为我的应用程序编写了一个新插件,并将其放入所有其他插件所在的文件夹中

i wrote a new plugin for my app and put it into the same folder where all the other plugins are

我的所有插件都继承自通常称为doctypes的插件类. doctype类再次从IPlugin类继承

my plugins all inherit from a plugin class called doctypes which is in general.interfaces the doctype class inherits from the IPlugin class again

所有插件均可正确加载,但对于新插件,我会得到:

all plugins load correctly but for the new plugin i get:

< general.interfaces.DocType对象位于0x ...>

< general.interfaces.DocType object at 0x......>

代替

< PDF对象位于0x .......>

< PDF object at 0x.......>

在我看来,好像yapsy加载了主插件类,所有插件都从该主类继承,而主插件类本身又从IPlugin继承

it seems to me as if yapsy loaded the main plugin class from which all plugins inherit and which itself inherits from IPlugin

我的应用程序对所有插件均能正常工作,但我检查了新插件中的代码是否有任何差异,但一切似乎正确

my app works fine with all plugins except for the new one i checked for any differences in code but all things seem correct

推荐答案

我是yapsy的主要开发人员,我刚看到此消息...

I'm yapsy's main developer and I've just come across this message...

尽管我猜四个月后您还是去了别的地方

Though I guess after 4 months you went for something else but anyway.

我要指出的第一件事是,最好是在yapsy的跟踪器上填写错误报告:

The first thing I'd like to point to is that it could be best if you filled a bug report on yapsy's tracker at:

https://sourceforge.net/tracker/?group_id=208383

如果您决定这样做,那么也可以附加一些代码,这对我有很大帮助.

And if you decide to do so, it would help me a lot if you could also attach some pieces of code.

根据您在此处给出的简单描述,我很难说出问题出在哪里,但似乎至少可以将设置"复制为对Yapsy单元测试的一些改动.

From the simple description you gave here, it's hard for me to tell where the problem is, but it seems at least that the "settings" can be reproduced as a small alteration of some of yapsy's unit test.

无论如何,如果我不得不做出疯狂的猜测,那么问题可能出在(非常粗糙)使用Python的'issubclass'来识别各种类别的插件.这是因为类别"是通过父类别定义的,该类别必须是同一类别的所有插件都必须继承的父类(更确切地说是从...继承的类的实例").

If I had to do a wild guess anyway, the problem might come from the (very crude) use of Python's 'issubclass' to identify the plugins of various categories. Which comes from the fact that "categories" are defined w.r.t a parent class that all plugins of the same category must inherit from (more precisely "instances of a class inheriting from...").

如果您使用以下内容定义类别映射,则会引起混乱:

This would cause confusions if you defined the categories mapping with something like the following:

{
"GeneralDocCategory": general.interfaces.DocType,
"PDFcategory": general.interfaces.PDFDocType
}

PDFDocType继承自DocType的位置.问题的根源是母班及其子班之一的存在,以定义两个不同的类别.

Where PDFDocType inherits from DocType. And the source of the problem would be the presence of the mother class and one of its child classes to define two different categories.

解决方案可能是:

解决方案A/以更加巧妙的方式重新设计Yapsy(由于时间紧缺,Yapsy的主要仓库中不会很快发生,但是可以随意分叉/贡献/更改所有内容)

Solution A/ redesign yapsy in a more clever way (not happening soon in yapsy's main repo because of a dramatic lack of time but feel free to fork/contribute/change everything)

解决方案B/为非特定"文档类型(不是唯一的玩笑)定义了特定"类,以获取由类似以下内容定义的类别:

Solution B/ define a 'specific' class for 'unspecific' doc types (not -only- a joke) to get the categories defined by something like:

{
"UnkownDocCategory": general.interfaces.UnknownDocType,
"PDFcategory": general.interfaces.PDFDocType
}

其中UnknownDocType和PDFDocType都将继承DocType.

Where UnknownDocType and PDFDocType would both inherit DocType.

这篇关于yapsy无法正确加载插件的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆