#50717 closed defect (fixed)
py27-matplotlib @1.5.1_1: fails to import when locale is set to just `UTF-8`
Reported by: | petrrr | Owned by: | seanfarley (Sean Farley) |
---|---|---|---|
Priority: | Normal | Milestone: | |
Component: | ports | Version: | |
Keywords: | haspatch | Cc: | licia.faenza@…, mojca (Mojca Miklavec), gaia.soldati@… |
Port: | py-matplotlib |
Description (last modified by petrrr)
On an OS X 10.7.5 machine we get a somewhat strange error on import matplotlib
.
Here the traceback:
>>> import matplotlib Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py", line 1131, in <module> rcParams = rc_params() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py", line 975, in rc_params return rc_params_from_file(fname, fail_on_error) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py", line 1100, in rc_params_from_file config_from_file = _rc_params_in_file(fname, fail_on_error) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py", line 1018, in _rc_params_in_file with _open_file_or_url(fname) as fd: File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/contextlib.py", line 17, in __enter__ return self.gen.next() File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/matplotlib/__init__.py", line 1000, in _open_file_or_url encoding = locale.getdefaultlocale()[1] File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 543, in getdefaultlocale return _parse_localename(localename) File "/opt/local/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/locale.py", line 475, in _parse_localename raise ValueError, 'unknown locale: %s' % localename ValueError: unknown locale: UTF-8 >>>
The strange thing here is that the locale looks reasonable, the same version just importa fine on other OS X versions. Also after downgrade to an earlier version (py27-matplotlib @1.4.3_0+cairo+tkinter
), the import just works fine and the problem is gone.
The locale looks reasonable:
>>> import locale >>> locale.getpreferredencoding() 'UTF-8' ))) Any idea what's going on here? Is this an upstream issue?
Attachments (1)
Change History (13)
comment:1 Changed 9 years ago by petrrr
Description: | modified (diff) |
---|
comment:2 Changed 9 years ago by petrrr
comment:3 Changed 9 years ago by mojca (Mojca Miklavec)
Cc: | mojca@… added |
---|---|
Keywords: | haspatch added |
Summary: | py27-matplotlib @1.5.1_1: fails to import on OSX 10.7.5 → py27-matplotlib @1.5.1_1: fails to import when locale is set to just `UTF-8` |
Version: | 2.3.4 |
We could simply apply the upstream patch until the new version gets released.
I didn't try to recompile the patched package yet, but the problem can be reproduced with
$ export LC_ALL=UTF-8 $ /opt/local/bin/python2.7 >>> import matplotlib
and hopefully fixed after the patch.
Changed 9 years ago by mojca (Mojca Miklavec)
Attachment: | py-matplotlib-fixlocale.diff added |
---|
An upstream patch to work around UTF-8
locale in matplotlib
comment:5 Changed 9 years ago by petrrr
I am in favor of applying the patch, as it would fix the problem for users immediately.
comment:6 Changed 9 years ago by petrrr
Cc: | gaia.soldati@… added |
---|
comment:7 Changed 9 years ago by mojca (Mojca Miklavec)
Sean, can you please commit this? I happily do it myself (I just run "svn ci"), but I would prefer your blessing.
comment:9 Changed 9 years ago by petrrr
@mojca @sean: I already applied this because it caused issues for quite some people. Hope that is okay.
comment:10 Changed 9 years ago by petrrr
Resolution: | → fixed |
---|---|
Status: | new → closed |
comment:11 Changed 9 years ago by mojca (Mojca Miklavec)
Thank you. I didn't try to update in the last hour. I noticed you made a change in the ticket, but didn't check the sources.
comment:12 Changed 9 years ago by seanfarley (Sean Farley)
Yeah, if I'm not responding (as in this case), it usually means I'm traveling. So, please feel free to apply any patches :-)
Looks like this was already address upstream and should be solved in 1.5.2.