[Qgis-user] quit() and exit()

Stephen Sacks ssacks456 at gmail.com
Mon May 2 09:06:38 PDT 2022


I would like to terminate a Python script gracefully.  Both quit() and 
exit() not only abort the script but end the entire QGIS app.  For 
example, if a file I want to read doesn't exist, the following four 
lines of code terminate QGIS:

filePath = Path(fName)
if not filePath.is_file():
     print ('Unable to find file  ', fName)
     exit()

Substituting  quit() for exit()  doesn't help.  I could omit both, and 
put all of the remaining code under an "else" but that seems rather clunky.
   Any suggestions would be welcome.

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20220502/3496f25d/attachment.htm>


More information about the Qgis-user mailing list