Opened 8 years ago

Closed 8 years ago

Last modified 8 years ago

#2869 closed defect (fixed)

Default locale not found

Reported by: pmav99 Owned by: grass-dev@…
Priority: normal Milestone: 7.2.0
Component: Default Version: svn-trunk
Keywords: Cc:
CPU: Unspecified Platform: Unspecified

Description

I compiled GRASS on a docker container running Ubuntu 14.04.3. I am using trunk [67593] and I get the following traceback:

grassuser@c4219210d562:/usr/local/src$ grass
WARNING: Default locale settings are missing. GRASS running with C locale.
WARNING: Searched for a web browser, but none found
Starting GRASS GIS...
Traceback (most recent call last):
  File "/usr/bin/grass", line 1937, in <module>
    main()
  File "/usr/bin/grass", line 1834, in main
    grass_gui = check_gui(expected_gui=grass_gui)
  File "/usr/bin/grass", line 721, in check_gui
    p.stdin.write("variable=True".encode(ENCODING))
TypeError: encode() argument 1 must be string, not None

This is easily fixed by setting one of the relevant env variables, e.g.:

Error: Failed to load processor bash
No macro or processor named 'bash' found

But since the documentation states that getdefaultlocale() may return none, it might make sense to fallback to a default locale before giving up.

ENCODING = locale.getdefaultlocale()[1] or "utf-8"

If this is not desirable, then adding an explicit error message would certainly be more user friendly:

if ENCODING is None:
    sys.exit("Default locale not found ... ")

Change History (4)

comment:1 by annakrat, 8 years ago

Could you try r67607? It should fallback to UTF-8 and print a message.

comment:2 by pmav99, 8 years ago

Just tested this and it works.

comment:3 by annakrat, 8 years ago

Resolution: fixed
Status: newclosed

grass.py looks way different in release branch, so I won't backport.

comment:4 by neteler, 8 years ago

Milestone: 7.1.07.2.0

Milestone renamed

Note: See TracTickets for help on using tickets.