Re: not start

Tom Parker <[email protected]>
Newsgroups gmane.comp.gnome.apps.pybliographer
Message-ID <[email protected]>
zunbeltz wrote:
> The output of this command is
> 
> (None, None)
> 
> This means that there is an error with the locale module?

That output means that we don't have any better idea about the proper 
file encoding, and so we should decide to stick to default ascii file 
encodings.

>>If that's so, then can you please inform us of the environment variables
>>that you have set to 'eu_ES' so that we can work around this bug for
>>now, but I would also advise reporting this to the main python bugs
>>reporting system
>>(http://sourceforge.net/tracker/?group_id=5470&atid=105470) as this is
>>actually a problem in Python itself, rather than in Pybliographer.
> 
> LANGUAGE is set to eu_ES. If you say that the output of the command above
> is incorrect, I would report the bug to python myself.

I've now managed to reproduce the bug, with the following command line

LANG=eu_ES python2.4 -c "import locale;
locale.setlocale (locale.LC_ALL, '')"

Given that the python manuals specify 
"locale.setlocale(locale.LC_ALL,'')" as definately being the correct 
command to tell python to use the user's default settings, this is a bug 
in python itself, and should be reported as such to the Python developers.

However, until this gets fixed there, I've just written a quick patch 
against pybliographer that will work around this problem (by ignoring 
your locale settings if errors occur while trying to set them), which 
I've attached.

Tom Parker
-- 
[email protected] - http://tevp.net
Illegitimus non carborundum
locale.patch (text/x-patch, 631 B)
--- pybliographer.old	2005-04-05 12:37:06.105937881 +0200
+++ pybliographer	2005-04-05 12:39:15.073642777 +0200
@@ -32,12 +32,18 @@
 sys.path.insert (0, '.')
 
 import locale
-locale.setlocale (locale.LC_ALL, '')
+try:
+	locale.setlocale (locale.LC_ALL, '')
+except (ValueError,locale.Error):
+	pass
 
 import gettext
 gettext.install (progname, localedir, unicode = True)
 
-charset = locale.getlocale () [1] or 'ascii'
+try:
+	charset = locale.getlocale () [1] or 'ascii'
+except (ValueError,locale.Error):
+	charset = 'ascii'
 
 def print_version ():
 	print (_("This is %s, version %s") % (progname, version)).encode (charset)
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.