"Tanja Striepling" wrote:
> Hi there,
>
> just a short question. 
> I want to import something from a plugin into a helper script.
> The helper is in freevo/src/helper and the plugin in /freevo/src/plugins.
>
> How do I have to do that?
>
> I tried this (in the helper script):
>
> First try:
> "import name_of_plugin_file" 
> gives  "ImportError: No module named name_of_plugin_file"
>
> Second try:
> "import plugins.name_of_plugin_file" 
> gives the complete output of the helper named "plugins" and then again
> "ImportError: No module named name_of_plugin_file"

Oops, right. Yes, there are some problems with that. The best way
would be to import freevo.plugins.name_of_plugin, but I guess that
would cause other problems. Maybe we should fix all this in Freevo 2.0
and don't change the python path. Anyone willing to do this?

Back to your problem: you could bypass import. The hack is used in
distribution.py to get distutils for python and not from the current
dir. Maybe this works:

| import imp
| 
| fp, pathname, description = imp.find_module('plugins.name_of_plugin' , 
sys.path[1:])
| name_of_plugin = imp.load_module('distutils', fp, pathname, description)


Dischi

-- 
My opinion is neither copyrighted nor trademarked, and it's price
competitive. If you like, I'll trade for one of yours.

Attachment: pgp2dpCLkexeb.pgp
Description: PGP signature

Reply via email to