summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSeth M Morton <seth.m.morton@gmail.com>2016-05-08 00:27:18 -0700
committerSeth M Morton <seth.m.morton@gmail.com>2016-05-08 00:27:18 -0700
commit35d11fd2c502ca44e7982380d635ef6384586115 (patch)
treec814c1d5a487f1c5c5b750489d9262db40b27abe
parent2abd857b9079c16e67166a012ee1b50f0883ad73 (diff)
downloadnatsort-35d11fd2c502ca44e7982380d635ef6384586115.tar.gz
Fixed locale error if no locale is loaded.
-rw-r--r--natsort/compat/locale.py5
1 files changed, 4 insertions, 1 deletions
diff --git a/natsort/compat/locale.py b/natsort/compat/locale.py
index 7134d29..4cbe5f5 100644
--- a/natsort/compat/locale.py
+++ b/natsort/compat/locale.py
@@ -63,7 +63,10 @@ except ImportError:
# characters are incorrectly blank. Here is a lookup table of the
# corrections I am aware of.
if dumb_sort():
- loc = '.'.join(locale.getlocale())
+ try:
+ loc = '.'.join(locale.getlocale())
+ except TypeError: # No locale loaded, default to ','
+ return ','
return {'de_DE.ISO8859-15': '.',
'es_ES.ISO8859-1': '.',
'de_AT.ISO8859-1': '.',