Full Version: Python-fu path of the plug-ins folder
You're currently viewing a stripped down version of our content. View the full version with proper formatting.

I'm using Python-fu to write a plugin. Is there any way to get the path of the plug-ins folder?
There isn't one single folder, there are "folders", so nothing says that the folder you are looking at is the right one (I use three additional folders besides the standard two, and furthermore they mostly contain soft links to script elsewhere.

If you want to know where your plugin is, use os.path.abspath(sys.argv[0]) (this is the full path to your plugin file..).

#!/usr/bin/env python
import os,sys
from gimpfu import *

def whoIam(case=None):
    case="Execution" if case is None else case
    print "----\n%s:\nsys.argv[0]=%s\nAbsolute=%s\nReal=%s" % (case,me,os.path.abspath(me),os.path.realpath(me))


    "whoiam","Who I am","Who I am", "", "", "", "WhoIAm","",[],[],whoIam,menu="<Image>/Test/"
The code above will show you that your plugin code is fully executed everytime (you get the "Iniialization" output, besides the one called as the actual plugin function).
If you want to get the list of folders that are set in preferences:
Thank you Kevin and Ofnuts for you replies. Very helpful! Smile