[GRASS-dev] G__getenv return different results from ctypes and from GRASS modules

Anna Petrášová kratochanna at gmail.com
Thu May 30 07:27:00 PDT 2013


Hi,


On Thu, May 30, 2013 at 3:29 PM, Pietro <peter.zamb at gmail.com> wrote:

> Hi all,
>
> Nikos A. found a strange behaviour... that I'm not able to understand...
>
> I'm in the North Carolina (PERMANENT):
>
> {{{
> In [1]: import grass.lib.gis as libgis  # import the ctypes
>
> In [2]: !g.mapset -p  # look in which mapset we are
> PERMANENT
>
> In [3]: libgis.G__getenv('MAPSET')  # look in which mapset we are using
> ctypes
> Out[3]: 'PERMANENT'
>
> In [4]: !g.mapset user1   # change the mapset
> Your shell continues to use the history for the old mapset
> You can switch the history by commands:
> history -w; history -r /data/gis/nc/user1/.bash_history;
> HISTFILE=/data/gis/nc/user1/.bash_history
>
> In [5]: !g.mapset -p  # look in which mapset we are
> user1
>
> In [6]: libgis.G__getenv('MAPSET')  # look in which mapset we are using
> ctypes
> Out[6]: 'PERMANENT'
>
> In [7]: !g.gisenv
> MAPSET=user1
> GISDBASE=/data/gis
> LOCATION_NAME=nc
> GUI=text
> GISDBASEE=/data/gis
>
> }}}
>
> Why the ctypes version return 'PERMANENT' instead of 'user1'?
>
> the flag "p" of the module g.mapset use exactly the same function.
>
>
> http://trac.osgeo.org/grass/browser/grass/trunk/general/g.mapset/main.c#L103
>
> http://trac.osgeo.org/grass/browser/grass/trunk/general/g.gisenv/main.c#L119
>
> There is someone that is able to understand what is not working?
> Any idea?
>

I have myself experienced similar problem and I think it's related to this
ticket [1].

[1] http://trac.osgeo.org/grass/ticket/717


Anna


>
> Best regards.
>
> Pietro
> _______________________________________________
> grass-dev mailing list
> grass-dev at lists.osgeo.org
> http://lists.osgeo.org/mailman/listinfo/grass-dev
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/grass-dev/attachments/20130530/cc9ba693/attachment-0001.html>


More information about the grass-dev mailing list