I want to automate the execution of Python console in QGIS. When QGIS start, Python console starts at the same time, and Python predetermined code wants to be executed.

Currently, in order to perform this behavior, the following procedures are required.

  1. Plugins -> Python Console
  2. Show editor -> Open file -> Run script

By setting up shortcut ("Setting -> Configure shortcuts"), starting of Python console (1) is possible.

However, subsequent processing (2) will be manual operation.

Is there any method of automating python console execution through processing (1) and (2)?

Python version: 2.7.4 (default, Apr 6 2013, 19:54:46) [MSC v.1500 32 bit (Intel)]
QGIS version: 2.0.1-Dufour


For QGIS 2.4 (not sure about 2.0.1) you can specify a Python file if you start QGIS from the command line. Type:

qgis --help

You will see something like:

GIS - 2.4.0-Chugiak 'Chugiak' (exported)
QGIS is a user friendly Open Source Geographic Information System.
Usage: /usr/bin/qgis.bin [OPTION] [FILE]
    [--code path]   run the given python file on load

So you can try:

qgis --code /path/to/your/script.py
| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.