0

I am trying to follow some simple instructions to use python for operating with QGIS from outside the application. Following the instructions in http://www.qgis.org/en/docs/pyqgis_developer_cookbook/intro.html#python-applications I am stocked where it says "These commands can be put into a bootstrap script that will take care of the startup". I never done this before, I have no idea how to create this type of script... The commands I should bootstrap are:

set PATH=C:\qgispath;%PATH%
set PYTHONPATH=c:\qgispath\python

That is, these are ways to temporarily set system environment variables. However, having both python and (of course) the cmd prompt (my OS is Win7), I have no idea how to create the bootstrap script, and then how to call it from python, can anybody help me?

Siguza
  • 21,155
  • 6
  • 52
  • 89
umbe1987
  • 2,894
  • 6
  • 35
  • 63

1 Answers1

0

By a bootstrap script, the documentation probably means a batch file, which initializes the path variables and then runs your application.

For instance, if you have application stored as qgis_sample.py, bootstrap_example.bat would look something like:

set PATH=C:\qgispath;%PATH%
set PYTHONPATH=c:\qgispath\python
python <path_to_application>\qgis_sample.py

Hope this helps!

EDIT:

For running the bat file using a python script, refer to: Run a .bat file using python code

Community
  • 1
  • 1
  • The problem is that I have to create this ".bat" file, and then call it from python, how do I do that? – umbe1987 Oct 21 '13 at 13:33
  • Refer to: http://stackoverflow.com/questions/5469301/run-a-bat-file-using-python-code. Editing the answer to add this information as well. – Sarthak Kukreti Oct 21 '13 at 13:47