[GRASS-dev] [GRASS GIS] #2145: wxGUI network analysis tool: fails to launch in French locale

#2145: wxGUI network analysis tool: fails to launch in French locale
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: network analysis tool | Platform: Linux
      Cpu: Unspecified |
-----------------------------------+----------------------------------------
In an environment with LANG=fr_BE.utf8, trying to launch the Vector
network analysis tool, gives the following error in the command console
(and the tool is not launched):

{{{
Traceback (most recent call last):
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/lmgr/frame.py", line
753, in OnVNet

self.GetMapDisplay().OnVNet(event)
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/mapdisp/frame.py", line
1233, in OnVNet

self.dialogs['vnet'] = VNETDialog(parent=self,
giface=self._giface)
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/vnet/dialogs.py", line
122, in __init__

self._createPointsPage()
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/vnet/dialogs.py", line
209, in _createPointsPage

self.list = PtsList(parent = pointsPanel, vnet_mgr =
self.vnet_mgr)
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/vnet/dialogs.py", line
1003, in __init__

self.AddItem()
   File
"/data/home/mlennert/SRC/GRASS/grass_trunk/dist.x86_64
-unknown-linux-gnu/etc/gui/wxpython/vnet/widgets.py", line
181, in AddItem

self.Append(map(str, itemData))
UnicodeEncodeError
:
'ascii' codec can't encode character u'\xe7' in position
219: ordinal not in range(128)
}}}

Moritz

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

#2145: wxGUI network analysis tool: fails to launch in French locale
-----------------------------------+----------------------------------------
Reporter: mlennert | Owner: grass-dev@…
     Type: defect | Status: new
Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Keywords: network analysis tool | Platform: Linux
      Cpu: Unspecified |
-----------------------------------+----------------------------------------

Comment(by annakrat):

This particular error should be fixed in r58490. There was an empty
translatable string which resulted in some garbage. However, once certain
strings get translated, you will get such errors again from multiple
places. The code is pretty complex, converting to string is there multiple
times and I am not sure how to fix this. In general, I don't really
understand how to deal with this issue and how to test it correctly.

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

#2145: wxGUI network analysis tool: fails to launch in French locale
-----------------------+----------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: closed
  Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: fixed | Keywords: network analysis tool
  Platform: Linux | Cpu: Unspecified
-----------------------+----------------------------------------------------
Changes (by mlennert):

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

Comment:

Replying to [comment:1 annakrat]:
> This particular error should be fixed in r58490. There was an empty
translatable string which resulted in some garbage.

Thanks. I can confirm the fix. Closing this bug.

> However, once certain strings get translated, you will get such errors
again from multiple places. The code is pretty complex, converting to
string is there multiple times and I am not sure how to fix this. In
general, I don't really understand how to deal with this issue and how to
test it correctly.

I don't think there is one good way to fix this, but if we could propose a
test protocol that allows developers to quickly test their work for
different locale settings then maybe it would make it easier to avoid such
issues in the first place.

Moritz

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

#2145: wxGUI network analysis tool: fails to launch in French locale
-----------------------+----------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: network analysis tool
  Platform: Linux | Cpu: Unspecified
-----------------------+----------------------------------------------------
Changes (by mlennert):

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

Comment:

I've got bitten by a similar bug using a fresh 7.0 release branch:

{{{
Traceback (most recent call last):
   File "/home/mlennert/SRC/grass70_release/dist.i686-pc-
linux-gnu/gui/wxpython/lmgr/frame.py", line 778, in OnVNet

self.GetMapDisplay().OnVNet(event)
   File "/home/mlennert/SRC/grass70_release/dist.i686-pc-
linux-gnu/gui/wxpython/mapdisp/frame.py", line 1419, in
OnVNet

self.dialogs['vnet'] = VNETDialog(parent=self,
giface=self._giface)
   File "/home/mlennert/SRC/grass70_release/dist.i686-pc-
linux-gnu/gui/wxpython/vnet/dialogs.py", line 122, in
__init__

self._createPointsPage()
   File "/home/mlennert/SRC/grass70_release/dist.i686-pc-
linux-gnu/gui/wxpython/vnet/dialogs.py", line 209, in
_createPointsPage

self.list = PtsList(parent = pointsPanel, vnet_mgr =
self.vnet_mgr)
   File "/home/mlennert/SRC/grass70_release/dist.i686-pc-
linux-gnu/gui/wxpython/vnet/dialogs.py", line 1007, in
__init__

self.SetData(iPt, pt_dt)
   File "/home/mlennert/SRC/grass70_release/dist.i686-pc-
linux-gnu/gui/wxpython/vnet/dialogs.py", line 1090, in
SetData

self.EditCellKey(key, k, v)
   File "/home/mlennert/SRC/grass70_release/dist.i686-pc-
linux-gnu/gui/wxpython/vnet/widgets.py", line 248, in
EditCellKey

self.SetStringItem(index, colNum, str(cellVal))
UnicodeEncodeError
:
'ascii' codec can't encode character u'\xe9' in position 10:
ordinal not in range(128)
}}}

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

#2145: wxGUI network analysis tool: fails to launch in French locale
-----------------------+----------------------------------------------------
  Reporter: mlennert | Owner: grass-dev@…
      Type: defect | Status: reopened
  Priority: normal | Milestone: 7.0.0
Component: wxGUI | Version: svn-trunk
Resolution: | Keywords: network analysis tool
  Platform: Linux | Cpu: Unspecified
-----------------------+----------------------------------------------------

Comment(by annakrat):

Replying to [comment:3 mlennert]:
> I've got bitten by a similar bug using a fresh 7.0 release branch:
>
Fixed in r62562, r62563. It tries to call str() on translatable string,
which is not a good practice. I fixed it on multiple other places too.

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