Re: Changing the Sys.Path for Python Plugins in Gnumeric



On 24 Aug 2008, Jean Bréfort wrote:

I'm not a python expert, but anyway, I think that our plugins mechanism
can't load several files. You might use several plugins (one for each
file) if the files are independents or rewrite the whole thing in C.
Jean

Thanks for the advice.  I may end up following your first
recommendation, but I'd prefer to use the import command, as I had
originally envisioned.

Some background:

Similar to the way that C uses the "include" directive, Python files
(including plugins in Gnumeric) are capable of importing other Python
files, e.g.

    import sys
    from numpy import *

I have tried moving some of my own Python files into the directories
listed in sys.path (using my mighty powers as root).  As I expected,
the referenced files import correctly, and the functions run in
Gnumeric.  But I'd like non-root users to be able to run the plugin,
with the files defining functions all loaded from the same local
directory.  So, again, does anyone know how I can change sys.path to
include the current directory?

Marc Grégoire



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]