I have a PyQGIS plugin where I save the current QGIS project to a PostgreSQL database using the following code:
uri = 'postgresql://postgres:createch@localhost:5432sslmode=disable&dbname=postgres&schema=test&project=test'
QgsProject.instance().write(uri)
This works fine for saving the project to the database. However, when I later try to save the project in QGIS using the ‘Save’ button, I get the following warning:
"The project file on the disk has been modified externally, saving the current project will overwrite any change. Do you still want to proceed?"
QGIS-Version: 3.22 ; 3.34
OS: Windows 10
I understand that this warning is likely due to the project being modified outside of QGIS, but in this case, it is part of the plugin’s functionality. How can I avoid or suppress this warning when saving the project again in QGIS?
juliusjulius is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.