There seems to be 2 different ways to start a Python QGIS standalone script.The official tutorial is using :
from qgis.core import *# supply path to where is your qgis installedQgsApplication.setPrefixPath("/path/to/qgis/installation", True)# load providersQgsApplication.initQgis()But I have also seen code looking like this :
from qgis.core.contextmanagers import qgisappwith qgisapp() as app: #do stuffFor example here and here.
I didn't see any reference to the latter method on the official doc.
Does anybody know if there is a difference between the two ?
أكثر...
from qgis.core import *# supply path to where is your qgis installedQgsApplication.setPrefixPath("/path/to/qgis/installation", True)# load providersQgsApplication.initQgis()But I have also seen code looking like this :
from qgis.core.contextmanagers import qgisappwith qgisapp() as app: #do stuffFor example here and here.
I didn't see any reference to the latter method on the official doc.
Does anybody know if there is a difference between the two ?
أكثر...