"Tanja Striepling" wrote:
> Thanks for your answer, unfortunately it is not working, or at least
> I am not able to figure out how it should work...

I just tried, here a working version to import plugins.file_ops from a
helper: 

| import imp
| import sys
| 
| fp, pathname, description = imp.find_module('plugins/file_ops', sys.path)
| file_ops = imp.load_module('file_ops', fp, pathname, description)

Now you can access file_ops.PluginInterface. It's a bad hack, I hope
to solve it for the final 2.0

> BTW, is there a way to get the path of the freevo installation?

Yes, there are some variables in config like config.SHARE_DIR to get
the share directory. To get the filename of the current module, you
can access the varibale __file__ in each module.

> I want to write a small helper for shutting down the system which
> makes use of the methodes of the wakeupshutdown plugin I sent today
> to the list.  Such a helper could then be used to shutdown the
> system from outside of freevo (for example the power button)
> inclusive setting of the new wakeup time.

Maybe move some stuff from the plugin to util to avoid the problems
above. BTW, such helper is in freevo cvs.

> An easy solution would be to rename helpers/plugins.py in something else,
> for example plugininfo.py.
> The helper script then would be just:
>
> import plugins.wakeupshutdown as sd
> sd.set_wakeup_and_shutdown()

OK, in this case the following should work:

| import imp
| import sys
| 
| fp, pathname, description = \
|             imp.find_module('plugins/wakeupshutdown', sys.path)
| sd = imp.load_module(wakeupshutdown', fp, pathname, description)
| sd.set_wakeup_and_shutdown()

HTH


Dischi

-- 
Hanson's Treatment of Time:
        There are never enough hours in a day, but always too many days
        before Saturday.

Attachment: pgpOwrByWjWew.pgp
Description: PGP signature

Reply via email to