mirror of
https://github.com/EDCD/EDMarketConnector.git
synced 2025-06-09 20:02:11 +03:00
Removed bare excepts
This commit is contained in:
parent
3ba8be5bf7
commit
7716cbd861
12
l10n.py
12
l10n.py
@ -21,7 +21,7 @@ if TYPE_CHECKING:
|
|||||||
|
|
||||||
try:
|
try:
|
||||||
locale.setlocale(locale.LC_ALL, '')
|
locale.setlocale(locale.LC_ALL, '')
|
||||||
except:
|
except Exception:
|
||||||
# Locale env variables incorrect or locale package not installed/configured on Linux, mysterious reasons on Windows
|
# Locale env variables incorrect or locale package not installed/configured on Linux, mysterious reasons on Windows
|
||||||
print("Can't set locale!")
|
print("Can't set locale!")
|
||||||
|
|
||||||
@ -100,7 +100,7 @@ class Translations(object):
|
|||||||
self.translations[plugin] = self.contents(lang, plugin_path)
|
self.translations[plugin] = self.contents(lang, plugin_path)
|
||||||
except UnicodeDecodeError as e:
|
except UnicodeDecodeError as e:
|
||||||
print(f'Malformed file {lang}.strings in plugin {plugin}: {e}')
|
print(f'Malformed file {lang}.strings in plugin {plugin}: {e}')
|
||||||
except:
|
except Exception:
|
||||||
print_exc()
|
print_exc()
|
||||||
builtins.__dict__['_'] = self.translate
|
builtins.__dict__['_'] = self.translate
|
||||||
|
|
||||||
@ -175,7 +175,7 @@ class Translations(object):
|
|||||||
if exists(f):
|
if exists(f):
|
||||||
try:
|
try:
|
||||||
return codecs.open(f, 'r', 'utf-8')
|
return codecs.open(f, 'r', 'utf-8')
|
||||||
except:
|
except Exception:
|
||||||
print_exc()
|
print_exc()
|
||||||
return None
|
return None
|
||||||
elif getattr(sys, 'frozen', False) and platform == 'darwin':
|
elif getattr(sys, 'frozen', False) and platform == 'darwin':
|
||||||
@ -220,12 +220,12 @@ class Locale(object):
|
|||||||
if platform == 'darwin':
|
if platform == 'darwin':
|
||||||
return self.float_formatter.numberFromString_(string)
|
return self.float_formatter.numberFromString_(string)
|
||||||
else:
|
else:
|
||||||
try:
|
try: # TODO: This is awful.
|
||||||
return locale.atoi(string)
|
return locale.atoi(string)
|
||||||
except:
|
except Exception:
|
||||||
try:
|
try:
|
||||||
return locale.atof(string)
|
return locale.atof(string)
|
||||||
except:
|
except Exception:
|
||||||
return None
|
return None
|
||||||
|
|
||||||
# Returns list of preferred language codes in RFC4646 format i.e. "lang[-script][-region]"
|
# Returns list of preferred language codes in RFC4646 format i.e. "lang[-script][-region]"
|
||||||
|
Loading…
x
Reference in New Issue
Block a user