[Qgis-user] Add processing script to toolbox

Nyall Dawson nyall.dawson at gmail.com
Tue Jul 31 23:11:26 PDT 2018


On Wed, 1 Aug 2018 at 16:03, Reginald <Reginald.Carlier at ingelmunster.be> wrote:
>
> >Hi Reginald,
>
> >I had a quick look at this. The issue here is that your script doesn't
> follow the QGIS 3 API for scripts, and >will need to be ported/upgraded.
>
> >I'd suggest a good approach would be to start from the template given when
> you select "Create New Script >from Template" from the processing toolbox
> toolbar. You basically put all your code into the >"processAlgorithm"
> function, so it only runs when the algorithm is executed, not when the
> script file is first >loaded. A quick scan shows that you use some
> deprecated 2.x api which will need to be fixed too - e.g.
> >iface.legendInterface() no longer exists. You can see a list of API breaks
> from 2.x to 3.x here: >https://qgis.org/api/api_break.html. There's also
> quite a lot of resources available via a quick google >search.
>
> >Hope that helps!
> >Nyall
>
> Hi Nyall,
>
> Thanks for looking in to this. Yesterday I installed qgis full from OSGEO4W
> installer and installed it in the default directory.
> When I opened QGIS 3.2 it showed the scripts that were adapted to the
> template were imported in the toolbox.
> So I guess there is some bug concerning changing the default directory
> “OSGEO4W64” to something else.
>

To confirm - you've already upgraded your script to the new API?

Nyall



More information about the Qgis-user mailing list