Background of my question: I would like to figure out the version of a plugin ('my_plugin'), in PyQGIS 2 like:
from qgis.utils import findPlugins import os plugins = list(findPlugins('C:\Users\me\.qgis2\python\plugins')) + list(findPlugins(os.environ['QGIS_PLUGINPATH'])) for p_name, p_info in plugins: if p_name == 'my_plugin': print(p_info.get('general', 'version'))
This works too in PyQGIS 3, except from the path where the plugins are stored (in QGIS 3 plugins are stored in the newly introduced user profiles, and from the GUI, the current plugin folder location can be accesses like described in this post: QGIS 3 Plugin folder location)
after some research my first idea was
from qgis.core import QgsUserProfile, QgsUserProfileManager current_profile = QgsUserProfileManager().userProfile() current_profile_folder = current_profile.folder()
So my question is: How to find the current user profiles plugin location using PyQGIS?