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

Victor Olaya volayaf at gmail.com
Tue Dec 15 03:45:23 PST 2015


I think this change that i just added should help with that

https://github.com/qgis/QGIS/commit/08a8b6095f09ffc88b8bf034470b1c5a3cab3486

Now the default scripts folder will always be in the users folder, no
matter how Processing is used/called.

Hope this helps!

2015-12-15 10:36 GMT+01:00 Anita Graser <anitagraser at gmx.at>:
>
>
> On Mon, Nov 30, 2015 at 5:16 PM, Victor Olaya <volayaf at gmail.com> wrote:
>>
>> The issue is that the "default" folder is based on the location of the
>> parent app (if I am not wrong). I can probably move it to somewhere in
>> .qgis2  instead. But if there is a manually entered path, then it will
>> not use the default one, that's only used if no custom configuration
>> has been done.
>>
>>
>> Let me check and will see how to fix this.
>
>
> Hi Victor,
> Have you had chance yet to look into this? I can work with a work-around for
> now but would be great to see this cleared up.
> Thanks and best wishes,
> Anita
>
>
>
>
>
>>
>>
>> 2015-11-30 15:23 GMT+01:00 Anita Graser <anitagraser at gmx.at>:
>> > On Fri, Nov 27, 2015 at 3:53 PM, Anita Graser <anitagraser at gmx.at>
>> > wrote:
>> >>
>> >> On Fri, Nov 27, 2015 at 8:58 AM, Victor Olaya <volayaf at gmail.com>
>> >> wrote:
>> >>>
>> >>> 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()
>> >>
>> >>
>> >> from processing.script.ScriptUtils import *
>> >> print ScriptUtils.scriptsFolder()
>> >>
>> >> if run in stand-alone, returns a wrong folder:
>> >> /home/agraser/temp/standaloneprocessing/processing/scripts
>> >> (/home/agraser/temp/standaloneprocessing is the location of my
>> >> stand-alone
>> >> script)
>> >>
>> >> instead of the correct folder in the QGIS console: u'
>> >> /home/agraser/.qgis2/processing/scripts'.
>> >>
>> >> 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.
>> >
>> >
>> > If I move the stand-alone script into
>> > /home/agraser/.qgis2/, I can execute it and it finds my custom
>> > Processing
>> > script.
>> >
>> > In any other location the script fails because Processing uses the wrong
>> > scripts folder.
>> >
>> > I'd rather not hard-code the scripts folder. Do you have an idea how to
>> > make
>> > Processing use its "default" scripts folder rather than something in the
>> > stand-alone script's location?
>> >
>> > Thanks and best wishes,
>> > Anita
>> >
>> >
>> >
>
>


More information about the Qgis-developer mailing list