Suppose that a gimp (PyGIMP) plugin needs access to some arbitrary image files distributed with the plug-in. Given that the set can be installed by the user anywhere, is there a way for the plug-in itself to determine its own installation path to use as a path prefix for those resources (e.g., images)?? I have tried searching the pdb, but I must be missing something.
Like in all python code, you can find your code origin using os.path.realpath(__file__)
, but since Gimp calls the script by its full path you can also use os.path.abspath(sys.argv[0])
.
However:
gimp.directory
, gimp.data_directory
, gimp.locale_directory
, gimp.plug_in_directory
.os.path.join(gimp.data_directory,'scripts')