Closed hjorthjort closed 8 years ago
Hi.
Yes. Known problem. I do not really consider this to be an issue in either Python or gitinspector. It's a misconfiguration in OS X.
Most of the hacks discussed on SO are not really proper solutions. I do not want it to fail silently either. The best solution I can think of is to perhaps spew out the warning about not being able to detect the the locale. This is already in there, but it's not catching that particular exception.
In any case, this has already been discussed in several reports in the issue tracker of gitinspector, most recently in issue #93.
As stated in that issue, I'll look at some "solution" to this when I have time.
There is a known bug in Python which causes gitinspector to break on many OS X systems. The call
locale.getlocale()
raises an error of the user has not explicitly set certain environment variables.This is a known, but unresolved bug in Python.
Example problem
For example, I have the following lines in my
.zshrc
-file:These environment variables are unset by default. But if I set these two environment variables to, everything works nicely.
If I reset them with
unset LC_ALL
and so forth, I get the following stack trace when running gitinspector:As you can see, the call fails internally in Python, and the checks imposed in the file are to no help. Pasted below is the offending line in
localization.py
in this repo, and some context. As you can see, the checks following it are of no help.Note that the problem is the same for the call
locale.getdefaultlocale()
. It fails in the same way.Proposed solution
You could hack around it. There is some interesting approaches in this Stack Overflow thread. Perhaps you could just catch the exception. Or you could include explicit instructions to OS X users to set these environment variables, without which gitinspector fails. Right now, OS X users are left to figure this tricky one out on their own.