diff options
author | Seth M Morton <seth.m.morton@gmail.com> | 2016-05-08 00:27:18 -0700 |
---|---|---|
committer | Seth M Morton <seth.m.morton@gmail.com> | 2016-05-08 00:27:18 -0700 |
commit | 35d11fd2c502ca44e7982380d635ef6384586115 (patch) | |
tree | c814c1d5a487f1c5c5b750489d9262db40b27abe | |
parent | 2abd857b9079c16e67166a012ee1b50f0883ad73 (diff) | |
download | natsort-35d11fd2c502ca44e7982380d635ef6384586115.tar.gz |
Fixed locale error if no locale is loaded.
-rw-r--r-- | natsort/compat/locale.py | 5 |
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': '.', |