[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]

[PATCH] Catch exceptions from gettext.GNUTranslations



Report with po/*.mo file caused the exception and keep going.  The
current failure is in po/tg.mo.
---
 scripts/getlangnames.py |    8 +++++++-
 1 files changed, 7 insertions(+), 1 deletions(-)

diff --git a/scripts/getlangnames.py b/scripts/getlangnames.py
index b81d26d..05b9805 100644
--- a/scripts/getlangnames.py
+++ b/scripts/getlangnames.py
@@ -32,7 +32,13 @@ for k in langs.localeInfo.keys():
             f = open("po/%s.mo" %(l,))
         except (OSError, IOError):
             continue
-        cat = gettext.GNUTranslations(f)
+
+        try:
+            cat = gettext.GNUTranslations(f)
+        except:
+            sys.stderr.write("*** ERROR reading po/%s.mo\n" % (l,))
+            continue
+
         cat.set_output_charset("utf-8")
         names[langs.localeInfo[k][0]] = cat.lgettext(langs.localeInfo[k][0])
         found = True
-- 
1.6.0.3


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]