#!/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
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