[QGIS-Developer] Current script path from python console

JD L jdaniel.lomenede at gmail.com
Tue Jan 5 03:54:10 PST 2021


Hi devs,

for a long time I used that code to get the __file__ when running

my scripts from the QGis python console. Is there a better way ?

Thxs,

import osfrom console.console import _console

script_path = _console.console.tabEditorWidget.currentWidget().path
print(os.path.dirname(script_path))
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20210105/8170cbb2/attachment.html>


More information about the QGIS-Developer mailing list