Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > comp.lang.python > #80454 > unrolled thread
| Started by | Albert-Jan Roskam <fomcl@yahoo.com> |
|---|---|
| First post | 2014-11-10 09:22 +0000 |
| Last post | 2014-11-10 09:22 +0000 |
| Articles | 1 — 1 participant |
Back to article view | Back to comp.lang.python
locale.getlocale() in cmd.exe vs. Idle Albert-Jan Roskam <fomcl@yahoo.com> - 2014-11-10 09:22 +0000
| From | Albert-Jan Roskam <fomcl@yahoo.com> |
|---|---|
| Date | 2014-11-10 09:22 +0000 |
| Subject | locale.getlocale() in cmd.exe vs. Idle |
| Message-ID | <mailman.15617.1415611526.18130.python-list@python.org> |
Hi,
Why do I get different output for locale.getlocale() in Idle vs. cmd.exe?
# IDLE
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "copyright", "credits" or "license()" for more information.
>>> import locale
>>> locale.getdefaultlocale()
('nl_NL', 'cp1252')
>>> locale.getlocale()
('Dutch_Netherlands', '1252') # I need this specific notation
>>>
# cmd.exe or Ipython
C:\Users\albertjan>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.getdefaultlocale()
('nl_NL', 'cp1252')
>>> locale.getlocale()
(None, None)
# using setlocale does work (one of these instances when I answer my own question while writing to the Python list)
C:\Users\albertjan>python
Python 2.7.1 (r271:86832, Nov 27 2010, 18:30:46) [MSC v.1500 32 bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import locale
>>> locale.setlocale(locale.LC_ALL, "")
'Dutch_Netherlands.1252'
>>> locale.getlocale()
('Dutch_Netherlands', '1252')
Thank you!
Regards,
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a
fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Back to top | Article view | comp.lang.python
csiph-web