Chromium Code Reviews
chromiumcodereview-hr@appspot.gserviceaccount.com (chromiumcodereview-hr) | Please choose your nickname with Settings | Help | Chromium Project | Gerrit Changes | Sign out
(22)

Unified Diff: fix_encoding.py

Issue 6696094: Catch exception thrown on certain locale setup (Closed) Base URL: svn://svn.chromium.org/chrome/trunk/tools/depot_tools
Patch Set: Trap more exceptions... Created 9 years, 9 months ago
Use n/p to move between diff chunks; N/P to move between comments. Draft comments are only viewable by you.
Jump to:
View side-by-side diff with in-line comments
Download patch
« no previous file with comments | « no previous file | no next file » | no next file with comments »
Expand Comments ('e') | Collapse Comments ('c') | Show Comments Hide Comments ('s')
Index: fix_encoding.py
diff --git a/fix_encoding.py b/fix_encoding.py
index 5bfb58e30a6a6bb5fd00985be5f96adb9b2267ce..ab418695b20d50eca5b6f2874ad988d734087a4d 100644
--- a/fix_encoding.py
+++ b/fix_encoding.py
@@ -46,17 +46,23 @@ def fix_default_encoding():
if attr[0:3] != 'LC_':
continue
aref = getattr(locale, attr)
- locale.setlocale(aref, '')
+ try:
+ locale.setlocale(aref, '')
+ except locale.Error:
+ continue
try:
lang = locale.getlocale(aref)[0]
except (TypeError, ValueError):
- lang = None
+ continue
if lang:
try:
locale.setlocale(aref, (lang, 'UTF-8'))
except locale.Error:
os.environ[attr] = lang + '.UTF-8'
- locale.setlocale(locale.LC_ALL, '')
+ try:
+ locale.setlocale(locale.LC_ALL, '')
+ except locale.Error:
+ pass
return True
« no previous file with comments | « no previous file | no next file » | no next file with comments »

Powered by Google App Engine
This is Rietveld 408576698