Re: [Qgis-user] Close QGIS via PyQGIS

2020-05-14 Thread Christoph Jung
Thanks, it works like a charm :)

> Am 13.05.2020 um 22:17 schrieb Ujaval Gandhi :
> 
> 
> Yes. You can call QApplication.quit() from the python console.
>   
> Ujaval Gandhi
> Spatial Thoughts
> mobile: +91-8095684687
> email: uja...@spatialthoughts.com
> 
> Subscribe to our newsletter http://bit.ly/spatialthoughts-newsletter
> 
> 
> 
>> On Thu, May 14, 2020 at 12:46 AM Christoph Jung  wrote:
>> Hi Ujaval,
>> 
>> Thank you for your answer. I will try it out. 
>> 
>> One additional question to your description: is it possible to quit QGIS 
>> from the python console within QGIS, i.e. calling exitQgis or something else 
>> for the current application?
>> 
>> Christoph
>> 
 Am 13.05.2020 um 17:11 schrieb Ujaval Gandhi :
 
>>> 
>>> The way to do this is to launch a new QGIS instance without GUI, run your 
>>> pyqgis code and then exit.
>>> 
>>> qgs = QgsApplication([], False)
>>> qgs.initQgis()
>>> 
>>> .
>>> 
>>> qgs.exitQgis()
>>> 
>>> See a full example at 
>>> https://courses.spatialthoughts.com/pyqgis-in-a-day.html#writing-standalone-python-scripts
>>> 
>>> Ujaval Gandhi
>>> Spatial Thoughts
>>> mobile: +91-8095684687
>>> email: uja...@spatialthoughts.com
>>> 
>>> Subscribe to our newsletter http://bit.ly/spatialthoughts-newsletter
>>> 
>>> 
>>> 
 On Wed, May 13, 2020 at 7:48 PM Christoph Jung  
 wrote:
 Hello everyone,
 
 I want to create a scheduled task with opening QGIS, run a python script 
 and close the application at the end. Is it possible to close the current 
 QGIS application via PyQGIS? Or does anybody knows a better way to close 
 QGIS at the end of the task?
 
 Sincerely,
 Christoph
 ___
 Qgis-user mailing list
 Qgis-user@lists.osgeo.org
 List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
 Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Close QGIS via PyQGIS

2020-05-13 Thread Ujaval Gandhi
Yes. You can call QApplication.quit() from the python console.
[image: Logo] 
Ujaval Gandhi
Spatial Thoughts
mobile: +91-8095684687
email: uja...@spatialthoughts.com
[image: LinkedIn icon]   [image:
Twitter icon] 
Subscribe to our newsletter http://bit.ly/spatialthoughts-newsletter


On Thu, May 14, 2020 at 12:46 AM Christoph Jung 
wrote:

> Hi Ujaval,
>
> Thank you for your answer. I will try it out.
>
> One additional question to your description: is it possible to quit QGIS
> from the python console within QGIS, i.e. calling exitQgis or something
> else for the current application?
>
> Christoph
>
> Am 13.05.2020 um 17:11 schrieb Ujaval Gandhi :
>
> 
> The way to do this is to launch a new QGIS instance without GUI, run your
> pyqgis code and then exit.
>
> qgs = QgsApplication([], False)
> qgs.initQgis()
>
> .
>
> qgs.exitQgis()
>
> See a full example at
> https://courses.spatialthoughts.com/pyqgis-in-a-day.html#writing-standalone-python-scripts
> [image: Logo] 
> Ujaval Gandhi
> Spatial Thoughts
> mobile: +91-8095684687
> email: uja...@spatialthoughts.com
> [image: LinkedIn icon]   [image:
> Twitter icon] 
> Subscribe to our newsletter http://bit.ly/spatialthoughts-newsletter
>
>
> On Wed, May 13, 2020 at 7:48 PM Christoph Jung 
> wrote:
>
>> Hello everyone,
>>
>> I want to create a scheduled task with opening QGIS, run a python script
>> and close the application at the end. Is it possible to close the current
>> QGIS application via PyQGIS? Or does anybody knows a better way to close
>> QGIS at the end of the task?
>>
>> Sincerely,
>> Christoph
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
>
>
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Close QGIS via PyQGIS

2020-05-13 Thread Christoph Jung
Hi Ujaval,

Thank you for your answer. I will try it out. 

One additional question to your description: is it possible to quit QGIS from 
the python console within QGIS, i.e. calling exitQgis or something else for the 
current application?

Christoph

> Am 13.05.2020 um 17:11 schrieb Ujaval Gandhi :
> 
> 
> The way to do this is to launch a new QGIS instance without GUI, run your 
> pyqgis code and then exit.
> 
> qgs = QgsApplication([], False)
> qgs.initQgis()
> 
> .
> 
> qgs.exitQgis()
> 
> See a full example at 
> https://courses.spatialthoughts.com/pyqgis-in-a-day.html#writing-standalone-python-scripts
>   
> Ujaval Gandhi
> Spatial Thoughts
> mobile: +91-8095684687
> email: uja...@spatialthoughts.com
> 
> Subscribe to our newsletter http://bit.ly/spatialthoughts-newsletter
> 
> 
> 
>> On Wed, May 13, 2020 at 7:48 PM Christoph Jung  wrote:
>> Hello everyone,
>> 
>> I want to create a scheduled task with opening QGIS, run a python script and 
>> close the application at the end. Is it possible to close the current QGIS 
>> application via PyQGIS? Or does anybody knows a better way to close QGIS at 
>> the end of the task?
>> 
>> Sincerely,
>> Christoph
>> ___
>> Qgis-user mailing list
>> Qgis-user@lists.osgeo.org
>> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
>> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

Re: [Qgis-user] Close QGIS via PyQGIS

2020-05-13 Thread Ujaval Gandhi
The way to do this is to launch a new QGIS instance without GUI, run your
pyqgis code and then exit.

qgs = QgsApplication([], False)
qgs.initQgis()

.

qgs.exitQgis()

See a full example at
https://courses.spatialthoughts.com/pyqgis-in-a-day.html#writing-standalone-python-scripts
[image: Logo] 
Ujaval Gandhi
Spatial Thoughts
mobile: +91-8095684687
email: uja...@spatialthoughts.com
[image: LinkedIn icon]   [image:
Twitter icon] 
Subscribe to our newsletter http://bit.ly/spatialthoughts-newsletter


On Wed, May 13, 2020 at 7:48 PM Christoph Jung  wrote:

> Hello everyone,
>
> I want to create a scheduled task with opening QGIS, run a python script
> and close the application at the end. Is it possible to close the current
> QGIS application via PyQGIS? Or does anybody knows a better way to close
> QGIS at the end of the task?
>
> Sincerely,
> Christoph
> ___
> Qgis-user mailing list
> Qgis-user@lists.osgeo.org
> List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
> Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user

[Qgis-user] Close QGIS via PyQGIS

2020-05-13 Thread Christoph Jung
Hello everyone,
 
I want to create a scheduled task with opening QGIS, run a python script and 
close the application at the end. Is it possible to close the current QGIS 
application via PyQGIS? Or does anybody knows a better way to close QGIS at the 
end of the task?

Sincerely,
Christoph
___
Qgis-user mailing list
Qgis-user@lists.osgeo.org
List info: https://lists.osgeo.org/mailman/listinfo/qgis-user
Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-user