I wrote a processing tool, which exports some tables from PostGIS to package, and as part of the export, I am calling an external SQL file to add some triggers, etc. The SQL file is located as my script (C:\Users\XXXX\AppData\Roaming\QGIS\QGIS3\profiles\default\processing\scripts)

Currently, I linked the SQL file as follows.

path_to_sql = str(Path.home()) + "\\AppData\\Roaming\\QGIS\\QGIS3\\profiles\\default\\processing\\scripts\\bwk.sql"
sql_file = open(path_to_sql)

But I was wondering, why it does not work when I wrote path_to_sql = "\\bwk.sql" or path_to_sql ="bwk.sql" (No such file or directory: 'bwk.sql')

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.