This repository was archived by the owner on Jul 14, 2023. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 11
This repository was archived by the owner on Jul 14, 2023. It is now read-only.
Unknown locale error "ValueError: unknown locale: UTF-8” with default locale set in MacOSX and Ubuntu #63
Copy link
Copy link
Open
Milestone
Description
Got unknown locale error "ValueError: unknown locale: UTF-8” with default locale set in MacOSX and Ubuntu (15.10, 16.10, at least):
$ az-shell
Traceback (most recent call last):
File "/Users/yoichika/.pyenv/versions/3.5.1/lib/python3.5/runpy.py", line 170, in _run_module_as_main
"__main__", mod_spec)
File "/Users/yoichika/.pyenv/versions/3.5.1/lib/python3.5/runpy.py", line 85, in _run_code
exec(code, run_globals)
File "/Users/yoichika/.local/lib/python3.5/site-packages/azclishell/__main__.py", line 18, in <module>
from azclishell.app import Shell
File "/Users/yoichika/.local/lib/python3.5/site-packages/azclishell/app.py", line 20, in <module>
from azclishell.key_bindings import registry, get_section, sub_section
File "/Users/yoichika/.local/lib/python3.5/site-packages/azclishell/key_bindings.py", line 9, in <module>
from azclishell.telemetry import TC as telemetry
File "/Users/yoichika/.local/lib/python3.5/site-packages/azclishell/telemetry.py", line 69, in <module>
TC = Telemetry(INSTRUMENTATION_KEY)
File "/Users/yoichika/.local/lib/python3.5/site-packages/applicationinsights/TelemetryClient.py", line 27, in __init__
self._context = channel.TelemetryContext()
File "/Users/yoichika/.local/lib/python3.5/site-packages/applicationinsights/channel/TelemetryContext.py", line 39, in __init__
self.device = contracts.Device()
File "/Users/yoichika/.local/lib/python3.5/site-packages/applicationinsights/channel/contracts/Device.py", line 30, in __init__
self._initialize()
File "/Users/yoichika/.local/lib/python3.5/site-packages/applicationinsights/channel/TelemetryContext.py", line 14, in device_initialize
self.locale = locale.getdefaultlocale()[0]
File "/Users/yoichika/.pyenv/versions/3.5.1/lib/python3.5/locale.py", line 559, in getdefaultlocale
return _parse_localename(localename)
File "/Users/yoichika/.pyenv/versions/3.5.1/lib/python3.5/locale.py", line 487, in _parse_localename
raise ValueError('unknown locale: %s' % localename)
ValueError: unknown locale: UTF-8
This is actually an error from ApplicationInsight package, NOT from azure-cli-shell. However there should be some error handling placed in azure-cli-shell as long as it depends on ApplicationInsight package.
Default locale set on MacOS and Ubuntu is UTF-8:
$ locale
LC_CTYPE=UTF-8
This issue must be related to this bug report and this can be resolved by adding locale configuration like this:
export LC_ALL=en_US.UTF-8
export LANG=en_US.UTF-8
My suggestion for the issue is:
- To add some error handling to azure-cli-shell so as not to have the error with default locale set
- To display warning message if locale set configuration isn't good enough in order to lead users to configure their locale set
Reactions are currently unavailable