[Qgis-user] Python Plugin Directory variable

Martin Dobias wonder.sk at gmail.com
Thu Jun 4 06:39:08 PDT 2009


On Wed, Jun 3, 2009 at 3:22 PM, Sampson, David
<David.Sampson at nrcan-rncan.gc.ca> wrote:
> Is there a variable I can call that points to the various plugin
> directories?
>
> I have a plugin that I am developiong and I want to use relative file paths
> but it screams at me unl;ess I call qgis from the directory that the plugin
> is in.

There are two directories which contain QGIS plugins:
- the "master" directory with plugins installed directly in QGIS installation
   QgsApplication.pkgDataPath() + "/python/plugins"
- "user's" directory with plugins installed by user (using plugin installer)
   QgsApplication.qgisSettingsDirPath() + "/python/plugins"

The reason is that the master directory is usually read-only for
normal user, so installing plugins into user's home directory is the
way to go.

Typical paths (on linux):
- pkgDataPath is /usr/share/qgis when using distribution's package,
/usr/local/share/qgis when built manually
- qgisSettingsDirPath is /home/someuser/.qgis

Martin



More information about the Qgis-user mailing list