-
Notifications
You must be signed in to change notification settings - Fork 446
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
Locale.parse('zh_CN') raises a TypeError on Babel 2.0 with Python 3.3 and 3.4. #174
Comments
@jun66j5 thanks for your report! Babel was barely maintained for some time and we're some new people trying to get it up to speed again. Because of this it might take some time until we're able to adress this bug. |
@jun66j5 is this working in the previous (1.x) release? |
Babel 1.3 works fine with Python 3.3 and 3.4.
|
I got the a similar error trying to compile Python documentation with Sphinx. |
Same error here. If I clone and checkout branch 2.0 and run:
everything works fine (both |
I can't reproduce the error. Both running directly at the Python interpreter and writing a new test case and running against |
|
To reproduce the error:
The problem is, that the If I create the
|
To reproduce the error:
|
This is a really annoying issue. Ideally we would stop using pickle and switch to something we can efficiently load from disk (msgpack as a start). Long term it would be great if we could mmap something, but unfortunately that might be pretty slow with the constant boxing :( |
As @jun66j5 says,
My environments is Windows 8.1 and Python 3.4.3. |
I think this error happens in window environments |
…ncompatible pickle format between python 2 and 3 (python-babel#174)
…d incompatible pickle format between python 2 and 3 (python-babel#174)
@jun66j5 |
Thanks, @erickwilder. Updated https://github.com/jun66j5/babel/commits/issue174/workaround. Root cause is incompatible pickle data for Should I create a pull request with that branch? |
@jun66j5 |
To avoid incompatible *.dat files between Python 2 and 3.
To avoid incompatible *.dat files between Python 2 and 3.
Ran into this one as well on Windows & 3.4: https://ci.appveyor.com/project/ericholscher/sphinx-autoapi/build/1.0.5
|
To avoid incompatible *.dat files between Python 2 and 3. Added unit tests for that *.dat files have only babel classes Author: Jun Omae <jun66j5@gmail.com>
Hi, I got this issue (TypeError in babel.core.get_global()) when working on porting the OpenStack Horizon project to Python 3. I confirm that the problem is that the file babel/global.dat of Babel-2.0.tar.gz (the file hosted at PyPI) cannot be loaded by Python 3. I also confirm that the root issue is that Babel uses datetime.date objects in global.dat. Python 2 serializes a datetime.date using a native string which is serialized to the pickle opcode SHORT_BINSTRING. On Python 3, this opcode produces a Unicode string, whereas datetime.date constructor only accepts a bytes string. Python 3 serializes a datetime.date differently: as a Unicode string encoded to latin1 (it calls the method .encode('latin1') on the string). The Python 3 output works on Python 2 and Python 3. See the Python bug 13505: Bytes objects pickled in 3.x with protocol <=2 are unpickled incorrectly in 2.x. So a workaround is to produce babel/global.dat using Python 3. A better fix is to avoid the datetime.date type: #188 implements this, +1 for this fix ;-) |
Backporting #174 bugfix to 2.x version
Cool! The fix (#188) was merged! Would it be possible to get a bugfix release? The latest Babel release on PyPI is incompatible with Python 3 :-( |
@Haypo we're still not having access to pypi to update that, it's a bit hard to reach the old maintainer. You can install Babel from git in the meantime: https://pip.pypa.io/en/latest/reference/pip_install.html#git @erickwilder closing as it was fixed |
…ironment. Closes #1976. see also: * python-babel/babel#174 * python-babel/babel#188 Version spec syntax "babel>=1.3,!=2.0" is following PEP440: https://www.python.org/dev/peps/pep-0440/#version-exclusion and it works with pip 6.0 or later (I didn't check before pip 6.0).
Locale.parse('zh_CN')
should work and loadzh_CN
localedata.On Python 2.7, it works fine.
The text was updated successfully, but these errors were encountered: