Skip to content
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.so still failing in r13 #1

Closed
GoogleCodeExporter opened this issue Apr 7, 2016 · 5 comments
Closed

_locale.so still failing in r13 #1

GoogleCodeExporter opened this issue Apr 7, 2016 · 5 comments

Comments

@GoogleCodeExporter
Copy link

What steps will reproduce the problem?
1. import datetime
1. datetime.datetime.strptime("2011-02-11T14:55:03", "%Y-%m-%dT%H:%M:%S")

What is the expected output? What do you see instead?
a datetime object, or a ValueError :)

Traceback (most recent call last):
File "<stdin>", line 1, in <module>
locale.Error: locale query failed

What version of the product are you using? On what operating system?
Interpreter: 13, extras 12, scripts 12

Please provide any additional information below.
Full traceback:

Traceback (most recent call last):
File "/mnt/sdcard/sl4a/scripts/_locale_test.py", line 3, in <module>
t = datetime.datetime.strptime("2011-02-11T14:05:04", "%Y-%m-%dT%H:%M:%S")
File 
"/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/
lib/python2.6/_strptime.py", line 270, in <module>
File 
"/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/
lib/python2.6/_strptime.py", line 188, in __init__                         
File 
"/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/
lib/python2.6/_strptime.py", line 70, in __init__
File 
"/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/
lib/python2.6/_strptime.py", line 29, in _getlang
File 
"/home/manuel/AptanaStudio3Workspace/python-for-android/python-build/output/usr/
lib/python2.6/locale.py", line 494, in getlocale
locale.Error: locale query failed

Original issue reported on code.google.com by brian.le...@gmail.com on 12 Feb 2011 at 1:00

Attachments:

@GoogleCodeExporter
Copy link
Author

Ohh dear... well we will have to work on this a bit more. Unfortunately Bionic 
(Android's version of libc) explicit says it doesn't support locales. Either we 
port from another library localeconv and all the locale pieces, or we need to 
do monkey patching.

Ok in the mean time there's a workaround you can try, it's a bit hacky but 
works, see the attached file. You should do this before calling strptime, doing 
it once is enough.

Original comment by naranjo....@gmail.com on 18 Feb 2011 at 6:11

  • Changed state: Started

Attachments:

@GoogleCodeExporter
Copy link
Author

Of course your patch works in this instance, but since there is no locale 
support in libc and since the locale.py module already has emulation code for 
use in these circumstances, why not just stop including _locale.so?

I read somewhere that Google suggests using ICU if locale support is really 
necessary.

Original comment by brian.le...@gmail.com on 22 Feb 2011 at 4:58

@GoogleCodeExporter
Copy link
Author

isn't _locale.so needed for optparse and others to work?

Original comment by naranjo....@gmail.com on 23 Feb 2011 at 9:39

@GoogleCodeExporter
Copy link
Author

If _locale.so is removed, then the fallback code in locale.py appears to work 
fine.  Both optparse and strptime work without it.

Original comment by brian.le...@gmail.com on 23 Feb 2011 at 3:10

@GoogleCodeExporter
Copy link
Author

Fixed in python release _r15
Removed _locale.so from release, as android doesn't support anyway. Module 
falls back to sensible defaults without it.

Original comment by rjmatthews62 on 20 Mar 2011 at 2:10

  • Changed state: Fixed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

1 participant