diff options
author | Ilya <ilyamaschenko@gmail.com> | 2017-02-18 14:52:39 +0900 |
---|---|---|
committer | Ilya <ilyamaschenko@gmail.com> | 2017-02-18 14:52:39 +0900 |
commit | 33bdf00775ccafd6de5f208c74c78104e9fd7859 (patch) | |
tree | 1cdfb8ec9051164bc122c9e9d5d37cbb209763a4 /plugins.d | |
parent | bafbfe859ba0041689e4bcc33bcf2624afb26ced (diff) |
python.d.plugin: OrderedDict import for python2.6 added
Diffstat (limited to 'plugins.d')
-rwxr-xr-x | plugins.d/python.d.plugin | 14 |
1 files changed, 10 insertions, 4 deletions
diff --git a/plugins.d/python.d.plugin b/plugins.d/python.d.plugin index 126041ab13..4fdfae3472 100755 --- a/plugins.d/python.d.plugin +++ b/plugins.d/python.d.plugin @@ -73,10 +73,16 @@ try: DICT = OrderedDict msg.info('YAML output is ordered') except ImportError: - ORDERED = False - DICT = dict - msg.info('YAML output is unordered') -else: + try: + from ordereddict import OrderedDict + ORDERED = True + DICT = OrderedDict + msg.info('YAML output is ordered') + except ImportError: + ORDERED = False + DICT = dict + msg.info('YAML output is unordered') +if ORDERED: def ordered_load(stream, Loader=yaml.Loader, object_pairs_hook=OrderedDict): class OrderedLoader(Loader): pass |