Re: [Qgis-developer] Proper way to get the path to gdal's executables from a python plugin
There are better ways than subprocess. You can try: import processing processing.runalg("gdalogr:warpreproject", list, of, params) This depends on the Processing plugin being enabled, though. Or you can try: from osgeo import gdal -- View this message in context: http://osgeo-org.1560.x6.nabble.com/Proper-way-to-get-the-path-to-gdal-s-executables-from-a-python-plugin-tp5263606p5263630.html Sent from the Quantum GIS - Developer mailing list archive at Nabble.com. ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer
[Qgis-developer] Proper way to get the path to gdal's executables from a python plugin
Dear List, I'm updating the RasterBender plugin and need to use the gdalwarp and gdal_translate command line tools from within Python. What is the recommended way to run gdal command line tools from within a QGIS plugin ? Here under Windows it works with : subprocess.check_call(''C:\\OSGeo4W\\bin\\gdalwarp... But obviously that won't work on other setups. Surprisingly it works too with : subprocess.check_call('gdalwarp... Will this work on all setups ? I have no Mac to test on, and am not completely aware of the differences between standalone installs and osgeo4w installs.. I looked into the GdalTools plugin and the Processing plugin, but their method to get the GdalTool seems excessively complex (the rely on some user settings which don't seem to be set here, and/or do some voodoo about environment variables which I don't really understand...). Thanks ! Olivier ___ Qgis-developer mailing list Qgis-developer@lists.osgeo.org List info: http://lists.osgeo.org/mailman/listinfo/qgis-developer Unsubscribe: http://lists.osgeo.org/mailman/listinfo/qgis-developer