[Qgis-developer] Processing scripts in stand-alone Python scripts

Victor Olaya volayaf at gmail.com
Thu Nov 26 23:58:21 PST 2015


I think this must be related to the configuration of the plugins folder.

The script provider reads scripts in the scripts folder, which is
configured as an option. Maybe that setting is not available in your
stand-alone script...since it is stored using QSettings. You can check
it calling ScriptUtils.scriptsFolder()

I have added an option to add a folder manually to the scripts
provider. So you can get the instance of the provider (as you do when
listing its content), and call the addAlgorithmsFromFolder method to
add your folder.

See the commit in here,

https://github.com/qgis/QGIS/commit/0a21d91be5ad788db3b58a568a2beed0d797e045

Let me know if you have questions

Cheers!



2015-11-26 23:43 GMT+01:00 Anita Graser <anitagraser at gmx.at>:
>
>
> On Thu, Nov 26, 2015 at 11:17 PM, Luigi Pirelli <luipir at gmail.com> wrote:
>>
>> processing.alglist('script') to retrieve the list of commands with
>> "script" string inside it's name or description
>> e.g.
>> processing.alglist('ogr')
>> returns a lot of elements... if we get one of them
>
> --- >8 ---------------------------- snip
>>
>> if the list is is empty => no commands/scripts found with "script"
>
>
> Thanks Luigi, but I'm not sure how this helps.
>
> scripts = Processing.getProviderFromName('scripts')
> print scripts.algs
>
> returns a NON-empty list when run in the Python console but an empty list
> when run in a stand-alone script.
>
> Some part of the initialization of the scripts provider seems to fail.
>
> Best wishes,
> Anita
>
>
>
>
>


More information about the Qgis-developer mailing list