1

I have downloaded script "Save features filtered by expression" in Processing toolbox -> Scripts (It is saved in /home/user/.QGIS/processing) and I would like to call this script in standalone PyQGIS script. It works nice if used in normal Ubuntu with QGIS.

I call it with this:

# select by attribute (select water)
input_file=sys.argv[1]
output_file=sys.argv[2]
expression='DN=1'
general.runalg("script:Savefeaturesbyfilteredexpression",input_file,expression,output_file)

But when I try use it with my Docker Image it is not working anymore because that directory does not exist. If I have the file downloaded where I should script copy to and how to call it?

I am asking in general how to use external script. Other processing tools (grass, gdal) works in my Docker Image, but this script has a error: Algorithm not found.

EDIT: I have copied the script (in docker image) to the same location as in Ubuntu. But it is still not working. Error: Algorithm is not found.

Is there a default folder to put external script and PyQGIS will automatically find it there and will use it or script can be anywhere and I am supposed call script by some function to make it working?

13
  • Why not use docker ADD (copy script dir to container) docs.docker.com/engine/reference/builder/#add – julsbreakdown Oct 31 '17 at 13:44
  • Wich docker image are you using ? – SIGIS Oct 31 '17 at 13:46
  • I created my own. I use ubuntu 16.04 and QGIS 2.18. But I would like to know some general answer about using external python scripts in pyQGIS not just in docker. – zubro Oct 31 '17 at 13:50
  • You say it works fine without the docker image. The script is missing in your container, so this explains why it is not working. So I don't see the problem – julsbreakdown Oct 31 '17 at 13:59
  • I have copied it to the /usr/share/qgis/python/plugins/processing/script but that is not working. I have the script in my image but I do not know where should it be and how to call it. Can it be anywhere and I am supposed to add it by some function to the script or is there default place where pyqgis look for the script...or what is the best practise to work with external python scripts in pyqgis. I will try to copy it to the folder /home/.qgis2/processing/scripts but It seem unusual to me if this folder structure is not created at all in default. It just doesn seem as normal place to put it. – zubro Oct 31 '17 at 14:17

Your Answer

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

Browse other questions tagged or ask your own question.