From: Peter L. <pet...@te...> - 2009-07-20 16:13:33
|
Sorry, My fingers were out phase with my brain. Correct version of windows XP python is 2.5.1 and nothing Else!! /Peter > So, clearly a bug with Python 2.1.1 on Windows XP. Of course that > version is not even supported anymore and hasn't been for a very long > time. What about Python 2.5 on Windows XP? > > On Mon, Jul 20, 2009 at 11:24 AM, Peter Landgren<pet...@te...> wrote: > > I ran this little test on win xp and linux: > > import locale > > import string > > print string.lowercase > > print locale.setlocale(locale.LC_ALL,'C') > > print string.lowercase > > print locale.setlocale(locale.LC_ALL,'') > > print string.lowercase > > > > Result on Win XP with Python 2.1.1: > > abcdefghijklmnopqrstuvwxyz > > C > > abcdefghijklmnopqrstuvwxyz > > Swedish_Sweden.1252 > > abcdefghijklmnopqrstuvwxyzâܣ׬Á║▀ÓßÔÒõÕµþÞÚÛÙýݯ´±‗¾¶§÷°¨·¹³²■ > > > > Result on Linux with Python 2.5.2: > > abcdefghijklmnopqrstuvwxyz > > C > > abcdefghijklmnopqrstuvwxyz > > sv_SE.UTF-8 > > abcdefghijklmnopqrstuvwxyz > > > > /Peter > > > >> What happens if you do this in the shell: > >> > >> lowercase=abcdefghijklmnopqrstuvwxyz > >> locale > >> echo $lowercase > >> export LC_ALL=C > >> locale > >> echo $lowercase > >> export LC_ALL= > >> locale > >> echo $lowercase > >> > >> On Mon, Jul 20, 2009 at 10:42 AM, Peter Landgren<pet...@te...> wrote: > >> > It's > >> > abcdefghijklmnopqrstuvwxyz > >> > > >> > /Peter > >> > > >> >> dunno, but I would expect the results to be different. I don't think > >> >> that Python is doing anything special here. Just regurgitating stuff > >> >> already in the OS. What's in string.lowercase before the try > >> >> statement? We might find our answer there. > >> >> > >> >> On Mon, Jul 20, 2009 at 10:21 AM, Peter Landgren<pet...@te...> wrote: > >> >> > OK, > >> >> > But does it answer why > >> >> > print string.lowercase > >> >> > outputs > >> >> > abcdefghijklmnopqrstuvwxyzâܣ׬Á║▀ÓßÔÒõÕµþÞÚÛÙýݯ´±‗¾¶§÷°¨·¹³²■ > >> >> > > >> >> > where char #27 to #65 are not lowercase in any locale? > >> >> > Maybe with the exception of â. > >> >> > /Peter > >> >> > > >> >> >> Quoting from the doc: > >> >> >> > >> >> >> setlocale( category[, locale]) > >> >> >> If locale is specified, it may be a string, a tuple of the form > >> >> >> (language code, encoding), or None. If it is a tuple, it is > >> >> >> converted to a string using the locale aliasing engine. If locale > >> >> >> is given and not None, setlocale() modifies the locale setting for > >> >> >> the category. The available categories are listed in the data > >> >> >> description below. The value is the name of a locale. An empty > >> >> >> string specifies the user's default settings. If the modification > >> >> >> of the locale fails, the exception Error is raised. If successful, > >> >> >> the new locale setting is returned. > >> >> >> If locale is omitted or None, the current setting for category is > >> >> >> returned. > >> >> >> > >> >> >> setlocale() is not thread safe on most systems. Applications > >> >> >> typically start with a call of > >> >> >> > >> >> >> import locale > >> >> >> locale.setlocale(locale.LC_ALL, '') > >> >> >> > >> >> >> This sets the locale for all categories to the user's default > >> >> >> setting (typically specified in the LANG environment variable). If > >> >> >> the locale is not changed thereafter, using multithreading should > >> >> >> not cause problems. > >> >> >> > >> >> >> Changed in version 2.0: Added support for tuple values of the > >> >> >> locale parameter. > >> >> >> > >> >> >> On Mon, Jul 20, 2009 at 10:00 AM, Peter Landgren<pet...@te...> wrote: > >> >> >> > Devs, > >> >> >> > > >> >> >> > I have located the statement that casuses the error: > >> >> >> > with this code in gramps.py > >> >> >> > try: > >> >> >> > locale.setlocale(locale.LC_ALL,'C') > >> >> >> > print "OK",len(string.lowercase) > >> >> >> > print string.lowercase > >> >> >> > locale.setlocale(locale.LC_ALL,'') > >> >> >> > print "ER",len(string.lowercase) > >> >> >> > print string.lowercase > >> >> >> > > >> >> >> > I get: > >> >> >> > OK 26 > >> >> >> > abcdefghijklmnopqrstuvwxyz > >> >> >> > ER 65 > >> >> >> > abcdefghijklmnopqrstuvwxyzâܣ׬Á║▀ÓßÔÒõÕµþÞÚÛÙýݯ´±‗¾¶§÷°¨·¹³²■ > >> >> >> > > >> >> >> > So, what does > >> >> >> > locale.setlocale(locale.LC_ALL,'') > >> >> >> > do? > >> >> >> > /Peter > >> >> >> > > >> >> >> > ---------------------------------------------------------------- > >> >> >> >--- --- --- ----- Enter the BlackBerry Developer Challenge > >> >> >> > This is your chance to win up to $100,000 in prizes! For a > >> >> >> > limited time, vendors submitting new applications to BlackBerry > >> >> >> > App World(TM) will have the opportunity to enter the BlackBerry > >> >> >> > Developer Challenge. See full prize details at: > >> >> >> > http://p.sf.net/sfu/Challenge > >> >> >> > _______________________________________________ > >> >> >> > Gramps-devel mailing list > >> >> >> > Gra...@li... > >> >> >> > https://lists.sourceforge.net/lists/listinfo/gramps-devel -- Peter Landgren Talken Hagen 671 94 BRUNSKOG 0570-530 21 070-635 4719 pet...@te... Skype: pgl4820.2 |