Issue1874

classification
Title: Jython fails to import os module when using tr_TR locale
Type: behaviour Severity: normal
Components: Core Versions: Jython 2.5
process
Status: open Resolution:
Dependencies: Superseder:
Assigned To: fwierzbicki Nosy List: amak, fwierzbicki, jjaggars, kabir, miclark
Priority: normal Keywords: patch

Created on 2012-04-11.17:18:03 by jjaggars, last changed 2013-02-19.21:43:57 by fwierzbicki.

Files
File name Uploaded Description Edit Remove
1874.patch kabir, 2012-04-18.14:25:29 Patch to get our tests working in Turkish
Messages
msg7045 (view) Author: Jesse Jaggars (jjaggars) Date: 2012-04-11.17:18:02
[jhjaggars ~]$ cd jython2.5.3b1/
[jhjaggars jython2.5.3b1]$ cat ~/bin/turkish.sh 
if [ "$LANG" == "tr_TR.UTF-8" ]; then
    echo "switching to english"
    export LC_ALL=en_US.UTF-8
    export LANG=en_US.UTF-8
else
    echo "switching to turkish"
    export LC_ALL=tr_TR.UTF-8
    export LANG=tr_TR.UTF-8
fi
[jhjaggars jython2.5.3b1]$ source ~/bin/turkish.sh 
switching to turkish
[jhjaggars jython2.5.3b1]$ java -jar jython.jar 
Jython 2.5.3b1 (2.5:5fa0a5810b25, Feb 22 2012, 12:39:02) 
[Java HotSpot(TM) 64-Bit Server VM (Apple Inc.)] on java1.6.0_31
>>> import os
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Users/jhjaggars/jython2.5.3b1/jython.jar/Lib/os.py", line 118, in <module>
ImportError: no os specific module found
>>> 

Changing os.py to print out sys.builtin_module_names yields the following tuple:

('sys', 'imp', 'gc', 'jffi', '_sre', '_threading', '_csv', 'exceptions', 'time', '_py_compile', 'struct', 'zipimport', '_functools', 'thread', 'ucnhash', 'synchronize', 'binascii', '_codecs', '_random', '_systemrestart', 'cmath', '_marshal', 'cStringIO', 'pos\u0131x', '_ast', 'operator', 'jarray', 'math', '_collections', 'errno', '_hashlib', '__builtin__', '_weakref', 'itertools', 'cPickle', 'array')

Note that 'posix' is actually 'pos\u0131x'.
msg7066 (view) Author: Kabir Khan (kabir) Date: 2012-04-18.14:25:29
The attached patch fixes the issues we were seeing in JBoss AS.

This fixes the issues we were seeing for:
https://issues.jboss.org/browse/AS7-4449
https://issues.jboss.org/browse/AS7-4301

However, I am not familiar with Python so there may well be issues unknown to me with the fixes made to PyString
msg7448 (view) Author: Alan Kennedy (amak) Date: 2012-08-28.21:55:22
Kabir: The patch looks good in relation to the changes to OS.py, which correctly lowercases the OS name.

But the changes to PyString should not be necessary, because they would affect lower-casing of all strings, which would be wrong for non-English locales.

http://docs.oracle.com/javase/6/docs/api/java/lang/String.html#toLowerCase%28%29

Do you find in your testing that the bug is not fixed, in relation to JBoss AS, when you only patch OS.java? Must you apply the PyString.java changes also to fix the issue? I expect not.
History
Date User Action Args
2013-02-19 21:43:57fwierzbickisetversions: + Jython 2.5, - 2.5.3b1
2012-08-28 21:55:22amaksetmessages: + msg7448
2012-08-10 21:21:35fwierzbickisetpriority: normal
assignee: fwierzbicki
nosy: + fwierzbicki
2012-06-05 20:11:30amaksetnosy: + amak
2012-04-18 14:25:30kabirsetfiles: + 1874.patch
keywords: + patch
messages: + msg7066
nosy: + kabir
2012-04-11 18:51:15miclarksetnosy: + miclark
2012-04-11 17:18:03jjaggarscreate