I would like to run a python script via qgis --code myscript.py and then immediately exit. I'm using iface.actionExit().trigger(), which kills QGIS when I run it from the python console, but not when put in the script that I pass to --code.
What's the right way to immediately exit?
Update: I've also tried sys.exit(). QGIS catches it and pops up a window with the following:
An error occured during execution of following code: execfile('myscript.py') Traceback (most recent call last): File "", line 1, in File "myscript.py", line 14, in sys.exit() SystemExitUpdate: os.kill(os.getpid(), 9) works but it's a dirty hack and I'm looking for something better.
أكثر...
What's the right way to immediately exit?
Update: I've also tried sys.exit(). QGIS catches it and pops up a window with the following:
An error occured during execution of following code: execfile('myscript.py') Traceback (most recent call last): File "", line 1, in File "myscript.py", line 14, in sys.exit() SystemExitUpdate: os.kill(os.getpid(), 9) works but it's a dirty hack and I'm looking for something better.
أكثر...