Issues with OpenStackClient / Locale / OSX

Bug #1436898 reported by Maish
14
This bug affects 2 people
Affects Status Importance Assigned to Milestone
python-openstackclient
Fix Released
Low
Unassigned

Bug Description

When running the openstack client from a Mac I get the following error

[msaidelk@MSAIDELK-M-10UB ~(keystone_maish)]$ openstack
Traceback (most recent call last):
  File "/usr/local/bin/openstack", line 11, in <module>
    sys.exit(main())
  File "/Library/Python/2.7/site-packages/openstackclient/shell.py", line 342, in main
    return OpenStackShell().run(argv)
  File "/Library/Python/2.7/site-packages/openstackclient/shell.py", line 79, in __init__
    command_manager=commandmanager.CommandManager('openstack.cli'))
  File "/Library/Python/2.7/site-packages/cliff/app.py", line 74, in __init__
    self._set_streams(stdin, stdout, stderr)
  File "/Library/Python/2.7/site-packages/cliff/app.py", line 82, in _set_streams
    locale.setlocale(locale.LC_ALL, '')
  File "/System/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 547, in setlocale
    return _setlocale(category, locale)
locale.Error: unsupported locale setting

all other python clients work without issues

Revision history for this message
Steve Martinelli (stevemar) wrote : Re: Unable to Launch OpenStack client on OSX
summary: - Unable to Launch OpenStack client
+ Unable to Launch OpenStack client on OSX
Revision history for this message
Steve Martinelli (stevemar) wrote :

Yep, I linked your own blog. My bad.

Revision history for this message
Maish (maishsk) wrote :

:)
Hi Steve. The bug still exists - even after doing the install as posted in the blog

Revision history for this message
Steve Martinelli (stevemar) wrote :

Maish, can you provide more detail about the locale settings you have set? Looks like this might be a cliff (https://pypi.python.org/pypi/cliff/1.10.1) issue on how it handles different locales (specifically on osx).

Revision history for this message
Dean Troyer (dtroyer) wrote :

Maish, I've developed OSC on OS/X 10.8 and 10.9 from the start. I suspect though that you may not have the same default locale setup I do, which is actually stock OS/X English whatever. A little more info on your versions and local would help, and I need to get up to speed on that myself.

Revision history for this message
Steve Martinelli (stevemar) wrote :

I think you'll have to set have: LC_ALL=<something> set:

for instance: export LC_ALL=en_GB.UTF-8

I'm not sure if there is a clean way to handle this from cliff.

Revision history for this message
Maish (maishsk) wrote :

I do agree that is is probably something with my locale settings

msaidelk@MSAIDELK-M-10UB:~$ locale
LANG="US"
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL="C"

Changing my locale to this
msaidelk@MSAIDELK-M-10UB:~$ locale
LANG="US"
LC_COLLATE="en_US.UTF-8"
LC_CTYPE="en_US.UTF-8"
LC_MESSAGES="en_US.UTF-8"
LC_MONETARY="en_US.UTF-8"
LC_NUMERIC="en_US.UTF-8"
LC_TIME="en_US.UTF-8"
LC_ALL="en_US.UTF-8"

The CLI works without any problems.

Does that help?

Revision history for this message
Dean Troyer (dtroyer) wrote :

My locale settings are by default:

 dtroyer@bunsen:~ $ locale
 LANG="en_US.UTF-8"
 LC_COLLATE="en_US.UTF-8"
 LC_CTYPE="en_US.UTF-8"
 LC_MESSAGES="en_US.UTF-8"
 LC_MONETARY="en_US.UTF-8"
 LC_NUMERIC="en_US.UTF-8"
 LC_TIME="en_US.UTF-8"
 LC_ALL=

I do this and it still works:

 dtroyer@bunsen:~ $ export LC_ALL="C"
 dtroyer@bunsen:~ $ locale
 LANG="en_US.UTF-8"
 LC_COLLATE="C"
 LC_CTYPE="C"
 LC_MESSAGES="C"
 LC_MONETARY="C"
 LC_NUMERIC="C"
 LC_TIME="C"
 LC_ALL="C"

With my settings identical to yours it still works. I turned off 'Set locale variables automatically' in iTerm and got this:

dtroyer@bunsen:~ $ locale
LANG=
LC_COLLATE="C"
LC_CTYPE="C"
LC_MESSAGES="C"
LC_MONETARY="C"
LC_NUMERIC="C"
LC_TIME="C"
LC_ALL=

Still worked.

There seem to be a number of oddities on OS/X and Python per Google (https://bugs.python.org/issue23739 is close, https://bugs.python.org/issue18378 isn't exact but smells similar)

I believe this is a combination of a couple of things, we just need to figure out what...

 OS/X: 10.9.5
 iTerm: 2.0
 Python: 2.7.5
 OSC: master (1.0.3++)
 cliff: 1.10.1

Changed in python-openstackclient:
status: New → Confirmed
importance: Undecided → Low
Revision history for this message
Steve Martinelli (stevemar) wrote :

Maish, i think with the latest cliff and osc this bug should be fixed.

cliff bug: https://bugs.launchpad.net/python-cliff/+bug/1445760 should be fixed with cliff>1.11.0, which unfortunately means that only the master branch of OSC has the fix, or you may update cliff manually.

summary: - Unable to Launch OpenStack client on OSX
+ Issues with OpenStackClient / Locale / OSX
Revision history for this message
Dean Troyer (dtroyer) wrote :

This looks fixed for me on Mavericks and both cliff and OSC master. Marking committed pending releases of both cliff and OSC.

Changed in python-openstackclient:
status: Confirmed → Fix Committed
Changed in python-openstackclient:
milestone: none → 1.6.0
status: Fix Committed → Fix Released
To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.