[GRASS-dev] [GRASS GIS] #630: "Mapset Access" broken (wxpython)

#630: "Mapset Access" broken (wxpython)
-------------------------+--------------------------------------------------
Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
     Type: defect | Status: new
Priority: normal | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Keywords: | Platform: MSWindows XP
      Cpu: Unspecified |
-------------------------+--------------------------------------------------
!WinGrass Native binary 6.4.0svn 37703 on winxp-64

Config->GIS Working Environment->Mapset Access returns this error message
(no dialog box appears):

{{{
Traceback (most recent call last):
   File "c:/GIS/GRASS-6-SVN/etc/wxpython/wxgui.py", line 373,
in OnMapsets

dlg = preferences.MapsetAccess(parent=self, id=wx.ID_ANY)
   File "c:\GIS\GRASS-6-SVN\etc\wxpython\gui_modules\preferen
ces.py", line 1735, in __init__

self.mapsetlb.LoadData(self.all_mapsets)
   File "c:\GIS\GRASS-6-SVN\etc\wxpython\gui_modules\preferen
ces.py", line 1814, in LoadData

stat_info = os.stat(mapsetPath)
WindowsError
:
[Error 123] The filename, directory name, or volume label
syntax is incorrect:
'C:\\GIS\\GISDataBase\\spearfish60\\\user1'
}}}

Note the double and, before the mapset, triple slashes.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/630&gt;
GRASS GIS <http://grass.osgeo.org>

#630: "Mapset Access" broken (wxpython)
-----------------------+----------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords:
  Platform: All | Cpu: Unspecified
-----------------------+----------------------------------------------------
Changes (by kyngchaos):

  * platform: MSWindows XP => All

Comment:

On Jun 14, 2009, at 12:08 PM, Cline, Royce L. wrote:

On OS X with 6.4RC4 and RC5 when using Config->GIS Working
Environment->Mapset Access I get the following error:

{{{
Sun Jun 14 11:29:28 2009) Command finished (0 sec)
Traceback (most recent call last):
  File
"/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpyt
hon/wxgui.py", line
366, in OnMapsets

dlg = preferences.MapsetAccess(parent=self,
id=wx.ID_ANY)
  File
"/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpyt
hon/gui_modules/prefer
ences.py", line 1732, in __init__

self.mapsetlb.LoadData(self.all_mapsets)

File
"/Applications/GRASS-6.4.app/Contents/MacOS/etc/wxpyt
hon/gui_modules/prefer
ences.py", line 1811, in LoadData

stat_info =
os.stat(mapsetPath)
OSError
:
[Errno 2] No such file or
directory:
'/Users/rcline/grassdata/oakesModel/\ngridTest01sql'
}}}

Mapset Access fails because the mapset gridTest01sql begins with "\n".

This results because the g.mapsets -l returns multiple lines:

{{{
GRASS 6.4.0RC4 (oakesModel):~ > g.mapsets -l
aquiferBnd aquifers boresModel01 boresModel02 drains grid_tran01
grid_tran03
gridTest01sql oakes2 PERMANENT testAreaTopo
}}}

In lines 1800-1805 of preferences.py the call to g.mapsets -l is made on
line1800.

{{{
        ret = gcmd.RunCommand('g.mapsets',
                              flags = 'l',
                              read = True)
        mapsets =
        if ret:
            mapsets = ret.rstrip(' \n').split(' ')
}}}

In line 1805, ret.rstrip(' \n').split(' '), only the trailing line feed is
removed and not the line feed following the first line. Line 1805 should
be replaced with:

{{{
mapsets = ret.replace('\n','').split()
}}}

That way both the last line feed and any line feeds on multiple lines are
removed. Using .split() removes the need to handle the trailing space.

The change fixes the problem for me in 6.4RC4 and 6.4RC5. It also fixed a
crash when starting wxpython and opening an existing workspace. Can
someone with svn access verify my solution and fix this.

When invoking Mapset Access from the TclTK GUI, the search order was the
current mapset, Permanent, other mapsets in alphabetical order. With the
wxpython GUI, the search order is mapsets in alphabetical order. Was this
change intentional? It breaks some of my scripts, as I assumed that the
current mapset would always be searched first.

Royce Cline

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/630#comment:1&gt;
GRASS GIS <http://grass.osgeo.org>

#630: "Mapset Access" broken (wxpython)
-----------------------+----------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords:
  Platform: All | Cpu: Unspecified
-----------------------+----------------------------------------------------
Comment (by kyngchaos):

Ah. Someone else just mentioned this to me, though they only had the
problem in RC5, not RC4. I couldn't get that exact problem to happen for
me, but it would hang the GUI when I tried this for a location with many
mapsets.

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/630#comment:2&gt;
GRASS GIS <http://grass.osgeo.org>

#630: "Mapset Access" broken (wxpython)
-----------------------+----------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords:
  Platform: All | Cpu: Unspecified
-----------------------+----------------------------------------------------
Comment (by martinl):

Replying to [comment:1 kyngchaos]:
{{{
> ret = gcmd.RunCommand('g.mapsets',
> flags = 'l',
> read = True)
> mapsets =
> if ret:
> mapsets = ret.rstrip(' \n').split(' ')
}}}
>
> In line 1805, ret.rstrip(' \n').split(' '), only the trailing line feed
is removed and not the line feed following the first line. Line 1805
should be replaced with:
>
{{{
> mapsets = ret.replace('\n','').split()
}}}
>
> That way both the last line feed and any line feeds on multiple lines
are removed. Using .split() removes the need to handle the trailing space.
>
> The change fixes the problem for me in 6.4RC4 and 6.4RC5. It also fixed
a crash when starting wxpython and opening an existing workspace. Can
someone with svn access verify my solution and fix this.

Fixed in r37880 (devbr6), r37881 (relbr64) and r37882 (trunk).

Martin

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/630#comment:3&gt;
GRASS GIS <http://grass.osgeo.org>

#630: "Mapset Access" broken (wxpython)
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: new
  Priority: normal | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: | Keywords:
  Platform: MSWindows XP | Cpu: x86-64
---------------------------+------------------------------------------------
Changes (by martinl):

  * platform: All => MSWindows XP
  * cpu: Unspecified => x86-64

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/630#comment:4&gt;
GRASS GIS <http://grass.osgeo.org>

#630: "Mapset Access" broken (wxpython)
---------------------------+------------------------------------------------
  Reporter: cnielsen | Owner: grass-dev@lists.osgeo.org
      Type: defect | Status: closed
  Priority: normal | Milestone: 6.4.0
Component: wxGUI | Version: 6.4.0 RCs
Resolution: fixed | Keywords:
  Platform: MSWindows XP | Cpu: x86-64
---------------------------+------------------------------------------------
Changes (by martinl):

  * status: new => closed
  * resolution: => fixed

--
Ticket URL: <http://trac.osgeo.org/grass/ticket/630#comment:5&gt;
GRASS GIS <http://grass.osgeo.org>