Hello all, I'm hitting my head on a wall trying to get the absolute path of a file.py in order to load a logo in a shortHelpString as shown below. dir_name = (os.path.dirname(__file__)) script_path = os.path.abspath(inspect.getfile(inspect.currentframe())) script_dir = os.path.dirname(script_path) logo_path = (os.path.join(script_dir, 'logo.png')) print(f"logo_path: {logo_path}") logoPath = "/Users/juliermegp/Library/Application Support/QGIS/QGIS3/profiles/default/processing/scripts/logo.png"
return f""" <h2>Example Algorithm</h2> <p>This algorithm demonstrates the use of a relative path to include an image in the help description.</p> <h3>Parameters</h3> <ul> <li><b>Input Raster Layer:</b> The raster layer to be processed.</li> <li><b>Output Raster Layer:</b> The resulting processed raster layer.</li> </ul> <h3>Usage</h3> <p>To use this algorithm, select the input raster layer and specify the desired output location for the processed raster layer.</p> <h3>Image Example</h3> <p>The following image provides an example of the expected output:</p> <img src="{image_url}" alt="Example Output Image" /> <h3>Notes</h3> <p>Ensure that the image file (example_output.png) is placed in the relative path <code>images/</code> within the plugin directory. This path is relative to the location of the algorithm script.</p> According to the variables above, only logoPath works the other ones don't. Could someone tell me why I can't get the absolute file using __file__? Could you give me a direction on how to achieve that? The script runs inside the scripts directory in QGIS directory. Thank you for your time in advance. Julierme -- ########################################## *Julierme G Pinheiro* *SDI Expert & Geoprocessing Specialist* Phone: +55 61 99994-3569 Website: GIS <https://www.udemy.com/course/qgis-server-para-iniciantes-instalacao-e-configuracao/>
_______________________________________________ QGIS-User mailing list QGIS-User@lists.osgeo.org List info: https://lists.osgeo.org/mailman/listinfo/qgis-user Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user