[GRASS-dev] g.mapsets: UnicodeDecodeError: 'utf8' codec can't decode bytes in position ...

Markus Neteler neteler at osgeo.org
Sat May 14 03:53:55 EDT 2011


On Sat, May 14, 2011 at 4:16 AM, Glynn Clements
<glynn at gclements.plus.com> wrote:
> Markus Neteler wrote:
>
>> Hi,
>>
>> I updated G6.4.svn (make distclean) and have g.mapsets failing (started with
>> no parameters) with
>>
>> UnicodeDecodeError: 'utf8' codec can't decode bytes in position
>> 84665-84666: invalid data
>> see
>> http://pastebin.com/BT1cHMJZ
>
> gui/wxpython/gui_modules/prompt.py:508
>
>            fileHistory = codecs.open(os.path.join(env['GISDBASE'],
>                                                   env['LOCATION_NAME'],
>                                                   env['MAPSET'],
>                                                   '.bash_history'),
>                                      encoding = 'utf-8', mode = 'r')
>
> This will result in the problem you describe if the .bash_history file
> contains any non-UTF-8 data, which is a definite possibility
> regardless of the user's locale settings.

I suspect that I played in that mapset with Japanese locale
settings which left something in .bash_history.

> I suggest adding errors='replace' or errors='ignore' when calling
> codecs.open().

I just made a try with errors='replace' and it works. The GUI is back.

Markus


More information about the grass-dev mailing list