New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
QT backend changes locale #1867
Comments
is it possible that the QT install is misconfigured? |
I am sorry, but I am not familiar with QT. Where would I search for configuration errors? All I found so far is http://qt-project.org/wiki/QtLocales
which makes it seem as if this behavior was intended. |
The standard convention is that libraries that are doing parsing of floating-point numbers are responsible for parsing those numbers in the correct locale (which for most formats is usually supposed to be "C") and not use the locale-aware APIs for doing so. Numpy, for example, implements their own floating-point parsing code to get around this, and matplotlib uses that when appropriate. matplotlib has had similar bugs in the past, but I'm not aware of any at the moment. You can see how we fixed ours, for example, here: The gist is to not use the C stdlib API Note that So -- sorry to give you the runaround, but I'm not sure this is a matplotlib bug -- it comes from the interaction of loading a GUI framework and the library you're using to read the data (in this case Cantera). I'm going to close this bug, but if you discover that this is caused by the reading of data by any part of matplotlib, feel free to reopen. |
Related issue: numba/numba#1569 |
Yeah -- I suppose it's fairly rare to run libllvm in a GUI application so this never got tested. |
I originally filed this as a bug against IPython, see ipython/ipython#3103
At some point, the QT backend calls setlocale() to localize the program. This leads to problems with other Python libraries relying on the default setting "C", especially in the parsing of floating point numbers: In Germany, we use "," as a decimal separator. In my case, I tried to use Cantera, a chemical kinetics library, which, due to the wrong locale setting, effectively floor()ed all numbers and produced lots of errors. See the bug report over at IPython for details.
Testcase:
It clearly is QT which calls setlocale:
I however still suggest you to store the old
setlocale(0)
value before initializing QT and restore it usingsetlocale(0, foo)
afterwards: If I write a script using a toolkit like QT, I expect it to mess with my environment. When I use a plotting module which does all the magic in the background, I do not. Alternatively, please put a warning somewhere, in large, friendly letters ;-)The text was updated successfully, but these errors were encountered: