[TxMt] PyMate locale not set correctly?
David Peckham
dave.peckham at me.com
Tue Sep 2 06:52:47 UTC 2008
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
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.macromates.com/textmate/attachments/20080901/72addb5d/attachment.html>
More information about the textmate
mailing list