2

I am trying to use GRASS algorithms in a plugin of mine, in order to improve the quality of a shapefile containing lines that will be used as a graph later. The first algorithm I want to use is the one that breaks the lines at their intersections : v.clean.break.

path_to_broken_lines = processing.runalg(
                "grass:v.clean",                                    #Algorithm name
                input,                                              #Path to the layer to break
                0,                                                  #Tool (0<=>break)
                0,                                                  #Threshold (not needed for this algorithm)
                "%f , %f, %f, %f "% (xmin , xmax , ymin , ymax),    #GRASS_REGION_PARAMETER <ParameterExtent>
                -1,                                                 #GRASS_SNAP_TOLERANCE_PARAMETER <ParameterNumber>
                0,                                                  #GRASS_MIN_AREA_PARAMETER <ParameterNumber>
                None,                                               #Errors file (None <=> temporary file)
                None)                                               #Output file path (None <=> temporary file)

Now, despite being the admin of my computer, I get an error saying that my company's policy is blocking the execution of the algorithm. Still, I can execute them manually by running the GRASS plugin, importing my file into grass (v.in.ogr) and using the algorithm afterwards, but it seems like I can't automate it.

My question is the following : is there a way to use "processing.runalg()" as admin ? I have found ways to execute shell scripts as an admin but it is not really the same problem, is it. The plugin would work if I launched QGIS as an administrator, but I do not really want to force the end users to launch QGIS as an admin just to be able to run a plugin they won't use daily.

1

Have you tried processing.runandload() ?

I'm using that when I run a grass:v.voronoi function and that works fine.

  • I've just tried it, unfortunately it doesn't work. It is the same error. I wonder how I can use the algorithm manually, but get blocked when trying to automate it, it makes no sense. :( – Ril8772 Jul 26 '16 at 7:10

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.