Is it possible to check whether QGIS3 was started by executing qgis.bat or qgis.exe directly?
I want to do some checks in the qgis.bat before qgis starts and make sure that qgis is always started by calling the qgis.bat.
Edit1:
One idea is to set an environment variable in the qgis bat and check in the startup.py if this environmental variable is found:
bat-file:
set batchfilestart="YES"
python part
import os
try:
env_value = os.environ.get("batchfilestart")
if env_value !="YES":
print ("QGIS not started by calling the bat file")
print (env_value)
else:
print("QGIS started by calling the bat file")
print (env_value)
except KeyError:
print("Not exist environment value for %s" % "key_maybe_not_exist")
Is there a better way to make sure I can always run some checks before QGIS starts?
No comments:
Post a Comment