[Qgis-user] running external script from qgis plugin

Torsten Lange torsten.lange at mail.de
Wed Apr 8 06:58:37 PDT 2015


Hi!

It took me a (looong) while to call an external script from a QGIS plugin on my Windows machine at work. I'm not sure if this was a problem with the two Python interpreters - from QGIS and from ArcGIS or what so ever... It worked with no issues on my linux machine.

The only way I managed to run my external script (it imports ogr, osr, and shapefile) is to dynamically create and run a cmd-batch script according to OSGeo4W.bat which I used as blueprint:

Content of my batch file:
@echo off
call "C:\pathTo\QGIS Brighton 2.6.1-1\bin\o4w_env.bat"
@echo on
cmd /c python "C:\pathToMy\externalScript.py" -i "C:\pathToMy\inputFile.dat" -o "C:\pathToMy\outputFile.shp"
exit

Is there an easier way to do it? Background of having the "core functionallity" in an external script is to make it usable also from command line or (if possible) from ArcGIS.

Thank you, Torsten
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-user/attachments/20150408/f4c000d3/attachment.html>


More information about the Qgis-user mailing list