Opened 11 years ago

Closed 9 years ago

#2145 closed defect (fixed)

wxGUI network analysis tool: fails to launch in French locale

Reported by: mlennert Owned by: grass-dev@…
Priority: normal Milestone: 7.0.0
Component: wxGUI Version: svn-trunk
Keywords: network analysis tool Cc:
CPU: Unspecified Platform: Linux

Description

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

Change History (5)

comment:1 by annakrat, 11 years ago

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.

in reply to:  1 comment:2 by mlennert, 11 years ago

Resolution: fixed
Status: newclosed

Replying to 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

comment:3 by mlennert, 10 years ago

Resolution: fixed
Status: closedreopened

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)

in reply to:  3 comment:4 by annakrat, 10 years ago

Replying to 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.

comment:5 by mlennert, 9 years ago

Resolution: fixed
Status: reopenedclosed

This is fixed for me both in release70 and trunk.

Closing the bug.

Note: See TracTickets for help on using tickets.