From: Benny M. <ben...@gm...> - 2010-02-03 23:33:42
|
2010/2/3 Josip <jo...@pi...>: > On 03.02.2010 22:02, Benny Malengier wrote: > >>> >>> How and where is the correct relationship calculator selected? >>> >>> I can't figure it out, but I have tried. >> >> File Relationship.py: >> >> try: >> lang = os.environ["LANG"] >> except: >> import locale >> lang = locale.getlocale()[0] >> >> My guess is that on windows os.environ fails, so the locale would >> create the string lang needed to decide relcalc to use. >> > > If LANG variable is not set then os.environ fails and try locale.getlocale > which also fails as they return nothing. > >>>> import os >>>> os.environ["LANG"] > Traceback (most recent call last): > File "<stdin>", line 1, in <module> > File "c:\Program Files (x86)\Python26\lib\os.py", line 423, in __getitem__ > return self.data[key.upper()] > KeyError: 'LANG' > >>>> print locale.getlocale()[0] > None >>>> print locale.getdefaultlocale()[0] > hr_HR Peter, do you add that if lang is still empty/None after above try/except block, to set it with getdefaultlocale as Josip indicates. We need the getlocale in linux for when LANG is not set. Benny > > > -- > Josip > |