This Python code:
#!/usr/bin/env python # encoding: utf-8
import sys import os import locale
def main(): print locale.setlocale(locale.LC_ALL, '') print locale.format("%d", 282929992, grouping=True)
if __name__ == '__main__': main()
produces the expected result when run under Python 2.5.2 from bash shell on Mac OS X:
en_US.UTF-8 282,929,992
and this unexpected result when run from PyMate: PyMate r8111 running Python 2.5.2 (/usr/bin/env python) >>> loc.py C/en_US.UTF-8/C/C/C/C 282929992
Notice that the integer is formatted into comma-separated groups when run from the shell, but not when run from PyMate.
Changing this line:
print locale.setlocale(locale.LC_ALL, '')
to this:
print locale.setlocale(locale.LC_ALL, 'en_US.UTF-8')
gives the expected results in PyMate.
Dave
On 2 Sep 2008, at 08:52, David Peckham wrote:
[...] and this unexpected result when run from PyMate: PyMate r8111 running Python 2.5.2 (/usr/bin/env python) >>> loc.py C/en_US.UTF-8/C/C/C/C 282929992
TM itself sets LC_CTYPE since it is only concerned about character encoding for the processes it launches (for stdin/out).
If you want to have LC_ALL set for the processes it launches, set it in Preferences → Advanced → Shell Variables.