<div dir="ltr"><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_extra"><br><div class="gmail_quote">On Fri, Nov 27, 2015 at 8:58 AM, Victor Olaya <span dir="ltr"><<a href="mailto:volayaf@gmail.com" target="_blank">volayaf@gmail.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">I think this must be related to the configuration of the plugins folder.<br>
<br>
The script provider reads scripts in the scripts folder, which is<br>
configured as an option. Maybe that setting is not available in your<br>
stand-alone script...since it is stored using QSettings. You can check<br>
it calling ScriptUtils.scriptsFolder()<br></blockquote><div><br></div><div><div class="gmail_default" style="font-size:small">from processing.script.ScriptUtils import *</div><div class="gmail_default" style="font-size:small">print ScriptUtils.scriptsFolder()</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">if run in stand-alone, returns a wrong folder: /home/agraser/temp/standaloneprocessing/processing/scripts</div><div class="gmail_default" style="font-size:small">(/home/agraser/temp/standaloneprocessing is the location of my stand-alone script)</div></div><div class="gmail_default" style="font-size:small"><br></div><div><div class="gmail_default" style="font-size:small">instead of the correct folder in the QGIS console: u'/home/agraser/.qgis2/processing/scripts'.</div></div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Seems like we are getting closer to where the real issue is hiding. Imho it makes little sense that the paths appear relative to the stand-alone script's location.</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small">Best wishes,</div><div class="gmail_default" style="font-size:small">Anita</div><div class="gmail_default" style="font-size:small"><br></div><div class="gmail_default" style="font-size:small"><br></div><div><br></div><div><br></div><div> </div><blockquote class="gmail_quote" style="margin:0px 0px 0px 0.8ex;border-left-width:1px;border-left-color:rgb(204,204,204);border-left-style:solid;padding-left:1ex">
<br>
I have added an option to add a folder manually to the scripts<br>
provider. So you can get the instance of the provider (as you do when<br>
listing its content), and call the addAlgorithmsFromFolder method to<br>
add your folder.<br>
<br>
See the commit in here,<br>
<br>
<a href="https://github.com/qgis/QGIS/commit/0a21d91be5ad788db3b58a568a2beed0d797e045" rel="noreferrer" target="_blank">https://github.com/qgis/QGIS/commit/0a21d91be5ad788db3b58a568a2beed0d797e045</a><br>
<br>
Let me know if you have questions<br>
<br>
Cheers!<br>
<div class=""><div class="h5"><br>
<br>
<br>
2015-11-26 23:43 GMT+01:00 Anita Graser <<a href="mailto:anitagraser@gmx.at">anitagraser@gmx.at</a>>:<br>
><br>
><br>
> On Thu, Nov 26, 2015 at 11:17 PM, Luigi Pirelli <<a href="mailto:luipir@gmail.com">luipir@gmail.com</a>> wrote:<br>
>><br>
>> processing.alglist('script') to retrieve the list of commands with<br>
>> "script" string inside it's name or description<br>
>> e.g.<br>
>> processing.alglist('ogr')<br>
>> returns a lot of elements... if we get one of them<br>
><br>
> --- >8 ---------------------------- snip<br>
>><br>
>> if the list is is empty => no commands/scripts found with "script"<br>
><br>
><br>
> Thanks Luigi, but I'm not sure how this helps.<br>
><br>
> scripts = Processing.getProviderFromName('scripts')<br>
> print scripts.algs<br>
><br>
> returns a NON-empty list when run in the Python console but an empty list<br>
> when run in a stand-alone script.<br>
><br>
> Some part of the initialization of the scripts provider seems to fail.<br>
><br>
> Best wishes,<br>
> Anita<br>
><br>
><br>
><br>
><br>
><br>
</div></div></blockquote></div><br></div></div>