[QGIS-Developer] JSON strings in global variables

Adam Borczyk adam.borczyk at gis-support.pl
Thu Apr 12 02:00:24 PDT 2018


Thanks for the response. First I tried to 'reset' the variables, but
without purging QGIS configs (~/.config/QGIS folder). Since there is no
'delete global variable' method in QGIS 2 API I just set all of the
variables I use to an empty string at the beginning of my code. This seems
to work for now (at least on OS that it hadn't before), but if it turns out
it's not the case, my next try will be string escaping.
Best regards

*Adam Borczyk*

*---------------------------------*
*GIS Support Sp. z o.o.*
DobrzaƄskiego 3,
<https://maps.google.com/?q=Dobrza%C5%84skiego+3,%C2%A0Lublin+20-262&entry=gmail&source=g>Lublin
20-262
<https://maps.google.com/?q=Dobrza%C5%84skiego+3,%C2%A0Lublin+20-262&entry=gmail&source=g>
tel. 814511490, NIP: 9462641761,
*www.gis-support.pl <http://www.gis-support.pl>*
info at gis-support.pl

On 10 April 2018 at 02:10, Nyall Dawson <nyall.dawson at gmail.com> wrote:

> On 10 April 2018 at 04:47, Adam Borczyk <adam.borczyk at gis-support.pl>
> wrote:
> > Hello everyone,
> >
> > I'm developing a plugin under QGIS 2 environment in which I use global
> > variables. I'd like to know if it's allowed to pass a JSON string into a
> > global variable?
> >
> > My globals were fine until (I guess) I started to pass in jsons and now I
> > face an issue I described here:
> > https://gis.stackexchange.com/questions/277623/global-
> variables-in-qgis-mixed-on-some-computers
> > - basically the assignment of values to variables is sometimes wrong,
> some
> > even stay empty sometimes and it feels to be totally random.
> >
> > If anyone knows if jsons could introduce any error in globals, I would be
> > grateful and it would narrow down my search. I don't know how are they
> > parsed, so maybe OS regional settings (commas and colons thing) also come
> > into play? Regards QGIS 2.18 and it's subversions (5, 9, 13, 18 etc.).
>
> Possibly - the guts of this are buried deep within the Qt library, but
> I'd be surprised to find if it's not correctly escaping the strings.
> I'd suggest manually escaping/unescaping them and see if that helps.
>
> You'll probably need to remove any existing variable settings keys to
> test properly.
>
> Nyall
>
>
>
> >
> > Best regards
> >
> > Adam Borczyk
> >
> >
> > _______________________________________________
> > QGIS-Developer mailing list
> > QGIS-Developer at lists.osgeo.org
> > List info: https://lists.osgeo.org/mailman/listinfo/qgis-developer
> > Unsubscribe: https://lists.osgeo.org/mailman/listinfo/qgis-developer
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20180412/effc08f8/attachment-0001.html>


More information about the QGIS-Developer mailing list