[Twisted-Python] twisted.plugin question
Jean-Paul Calderone
exarkun at divmod.com
Thu Jun 15 10:21:24 MDT 2006
On Thu, 15 Jun 2006 17:09:26 +0200, Terry Jones <terry at jon.es> wrote:
>Is the Twisted plugin system described here
>
> http://twistedmatrix.com/projects/core/documentation/howto/plugin.html
>
>still supported / functional?
Yes.
>
>I tried implementing the example on that page and couldn't make it
>work. Below is my simplified code from that example, in two files.
One problem with the code attached is that it creates a plugin class
which implements plugin.IMaterial but then goes and searches for
plugins which provide __main__.IMaterial. Since these aren't the same
interface, even without the pickle error no results will be found.
As for the pickle error itself, I'm not sure what's causing it. I
can't reproduce it myself. The exception suggests that either
"plugin" cannot be imported, or that it has no attribute IMaterial.
Since the module which defines the object being pickled imports
plugin and uses its IMaterial attribute, this seems unlikely, but
that is what the exception suggests to me.
>
>BTW, the code on that page in the section Extending an Existing Program is
>missing a 'from zope.interface import implements'. Also, the assumption
>that code is in a file called imatsim.py, and the curious 'from matsim
>import imatsim' could be explained. I guess the later is just a harmless
>anachronism?
I've created a ticket in the tracker for expanding the howto to explain
these things. Thanks for pointing out that they were not well explained.
Jean-Paul
More information about the Twisted-Python
mailing list